I have a project with demoApp which has application.properties in folder
/src/main/resources
Now I want to store the application.properties in some location like :
C:\Users\lenovo\Desktop\externalResource\resources
I have tried some work like setting the config location in setenv.bat file like
set spring.config.location=C:\Users\lenovo\Desktop\externalResource\resources\
Also used to set the path in system environment as :
CONF_DIR = C:\Users\lenovo\Desktop\externalResource\resources\
and try to access in code like :
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
PropertySourcesPlaceholderConfigurer propertySource = new PropertySourcesPlaceholderConfigurer();
ClassPathResource[] resource = new ClassPathResource[]{new ClassPathResource("file:${CONF_DIR}/application-external.properties")};
propertySource.setLocations(resource);
propertySource.setIgnoreUnresolvablePlaceholders(true);
return propertySource;
}
None of the previous solution worked for me which were provided in the previous question. What thing I am missing here?