-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spring.config.additional-location as environment variable does not work correctly #17843
Comments
@Fantaztig I am not sure what you've done or where the confusion comes from. The behaviour is described in the documentation. If that doesn't help, please share a small sample (github or project zip) with instructions to let us reproduce that locally. |
Okay, to clarify my confusion I made a simple demo project My expectation would be that I can set a system environment variable via Now, when I start the application it should print "Hello World!", instead I get Edit: FYI, we are running our applications on RHEL 6/7 with jdk 1.8 |
Thanks for the sample @Fantaztig. This looks like a bug to me. Instead of using the relaxed rules that we use for property binding, we are relying on Spring Framework's rules for getting a property from the System environment. While we fix this, you should be able to |
Hello, Is there still a bug in Spring Boot 2.2.1.RELEASE with "spring.config.additional-location"? Consider that we've application.properties in the classpath with defaults:
the -profile configurations are not loaded as expected in the order P3,P2,P1 ... or the default values defined in the classpath are not overwritten correctly. (the classpath provides profile based properties files too) The override seems to work just for profile P3 (... the last listed active profile). Many thanks. |
@skloessel Your problem doesn't appear to be related to this issue as you're not using an environment variable. If you think you may have found a bug, please open a new issue attaching a small sample project that reproduces the behaviour you have described above. |
Is this valid? I was under the impression that environment variables were not allowed to contain hyphens. |
@virtualdxs This issue isn't about hyphens in environment variables. It was about the recommended format for environment variables (uppercase separate by If you were referring to my comment, that was just a workaround till the fix was available. In any case, I might have meant If you have any more questions, please ask them on Gitter or StackOverflow. |
I think ADDITIONAL_LOCATION didn‘t work either, however I’m not 100% sure about that. |
We have a central yml file containing properties for our databases and would like to generically add those to our spring boot services.
We just upgraded to spring boot 2.1.6
What I attempted was to set
SPRING_CONFIG_ADDITIONALLOCATION
as system environment variable pointing to the location of the application.yml containing the db properties.Unfortunately, it wouldn't recognize the file, setting it with
SPRING_CONFIG_LOCATION
works fine however.As far as I understood the file in the additional location needs to be named application.yml as long as
spring.config.name
is not set otherwise. I even tried renaming and formatting it to application.properties.Is this the way it's supposed to be or did I anything wrong?
The text was updated successfully, but these errors were encountered: