On Spring Boot 2.3.4-RELEASE (and earlier versions)

I have an ENV variable to specify additional config file, either a folder or a files works locally (on Windows)

SPRING_CONFIG_ADDITIONAL_LOCATION=C:\temp\ SPRING_CONFIG_ADDITIONAL_LOCATION=C:\temp\application.properties

When running my app in a container, the "folder" value option does not work. The container run on RH Linux, in OpenShift (Kubernetes)

This works SPRING_CONFIG_ADDITIONAL_LOCATION=/mnt/properties/application.properties This doesn't SPRING_CONFIG_ADDITIONAL_LOCATION=/mnt/properties/

When a folder name is used, no properties files get picked up.

How the container differs from my local machine (windows)

  • The container in a RH linux
  • The folder itself is a mounted config map. I noticed that the files are links
$ cd /mnt/properties
$ ls -al
drwxrwsrwx. 3 root 1001770000 117 Oct 21 17:27 .
drwxr-xr-x. 1 root root        39 Oct 21 15:51 ..
drwxr-sr-x. 2 root 1001770000  64 Oct 21 17:27 ..2020_10_21_21_27_56.823838634
lrwxrwxrwx. 1 root 1001770000  31 Oct 21 17:27 ..data -> ..2020_10_21_21_27_56.823838634
lrwxrwxrwx. 1 root root        29 Oct 21 15:50 application.properties -> ..data/application.properties

I have turned on trace level logs on "org.springframework", but cannot see anything relevant

Comment From: filip-java

I found this : https://github.com/spring-projects/spring-framework/issues/20051 I think this should be supported, as Kubernetes will mount configMap as link

Comment From: wilkinsona

Your configuration on Linux is missing the trailing / that indicates that it is a directory location rather than a file location. The configuration should be the following:

SPRING_CONFIG_ADDITIONAL_LOCATION=/mnt/properties/

Comment From: filip-java

This was a mistake in the description. In the actual setup, it is there. Leaving the "/" out will crash saying it is mandatory

Comment From: scottfrederick

Leaving the "/" out will crash saying it is mandatory

That's only true when including a wildcard in the location. SPRING_CONFIG_ADDITIONAL_LOCATION=/mnt/properties/ will work as expected, SPRING_CONFIG_ADDITIONAL_LOCATION=/mnt/properties/* will cause an error.

As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. This is a question that would be better suited to Stack Overflow. If you feel that this is a bug, please provide a minimal sample that reproduces the issue.