I'm having problems in serving static content with spring-boot.
I have configured static content to be served through application.properties file like so:
static-location-path=/opt/myapp/static
spring.resources.static-locations=file:${static-location-path}/
Notice that it is outside of the jar file. Now if I launch my application with mvn spring-boot plugin like so:
mvn spring-boot:run -Drun.profiles=staging
Then the static files are served correctly, and I can access them.
But I do not want to run my application like this on the staging environment, but instead as a service, that can be automatically started on server boot. So I managed to build the application to a executable jar. Then I managed to launch it as an init.d service. The application is working otherwise correct, but it does no longer serve the static files. I checked, and the correct profile file (which determines which application.properties file should be used) should be loaded there correctly.
Main question is: How can I serve static content with spring-boot when the application is launched as a init.d service (jar), and I'm using application.properties configuration to serve the static content?
Maybe there's something I don't understand here. Supplementary questions related to this are:
Are the different application.properties files (under resources folder) also bundled inside the jar? Which would mean they should be found, and application would get the correct configuration values from there?
Can spring-boot serve static content at all when the application is bundled as jar and launched as a init.d service?
How could I debug the problem more? I know where the app logs are being written, so that helps at least some.