vendredi 17 mai 2019

How to create a directory on statup in spring boot project

I am making a directory to store all uploaded files in my spring boot app on startup. The path of this directory is stored in application.properties file. I am trying to read this path and create a directory on startupof project. I am not able to get the path while creating a directory on startup.

application.properties

upload.path = "/src/main/resources"

StorageProperties.java

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "upload") public class StorageProperties {

private String path;


public String getPath() {
    return path;
}

public void setPath(String path) {
    this.path = path;
}

}




Aucun commentaire:

Enregistrer un commentaire