We have a Spring Boot application which we are looking to deploy without an application.properties file in the jar. The application.properties file will be excluded when the jar is built using the maven jar plugin.
We want to provide only an external application.properties file when the application is run.
I have tried testing locally to specify the external configuration as per spring documentation
java -jar myjar --spring.config.location={path to properties file}
I have also tried to specify additional classpath with the -Dloader.path
.
I get this error
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.my.Application]; nested exception is java.io.FileNotFoundException: class path resource [application.properties] cannot be opened because it does not exist
Is there a way I can get around this? Or can a SpringBoot app not start up without an application.properties file in the jar?