Not reading properties for property file passed by -Dspring.config.location=<property file>
, where <property file>
does not have any extension.
Reproduce: Execute the the following example command -
java -Dspring.config.location=/mount/application-secret-property -jar /home/user/application.war
Where /mount/application-secret-property
does not have any extension
Related discussions:
- stackoverflow - spring-config-location-is-ignored
- Related code in spring boot
- Some more discussion on use case
Comment From: wilkinsona
Thanks for the report. This is working as designed so I think we should update the documentation. We should note that a file extension is required to identify which loader should handle the file. This applies both to a location that points to an individual file and to the files in a directory that is specified as the config location.
Comment From: wilkinsona
Actually, let's do two things. In addition to updating the documentation which we can do now, we can also consider adding support for loading configuration from files with no extension so that you don't have to rename the file to get it to work. I've opened https://github.com/spring-projects/spring-boot/issues/22280 to track that.