I've got a Spring Boot project that builds an executable war and is configured with an application.properties
file and a application-dev.properties
in src/main/resources
.
The first line in the application.properties
is spring.profiles.active=dev
, which triggers the inclusion of application-dev.properties
when running as expected.
My problem is that I can't seem to override these properties with an external properties source (after everything is jarred / warred up). For simple debugging, I've created a file settings.properties
in the root of my project, and specified spring.profiles.active=dev,deploy
in it hoping to also trigger the "deploy" profile.
However, when I run the following:
java -jar target/project-0.1.0-LOCAL-NA.war --spring.config.location=file:./settings.properties
the deploy profile is never enabled. I thought I had this working with a previous version (running 1.1.6.RELEASE now, coming from 1.0.2.RELEASE) but rolling back didn't help either.
Am I missing something obvious?
Update 1:
So while debugging I discovered that Environment.getActiveProfiles()
will only return 1 item, even if there's multiple active profiles (dev & deploy in this case). So, while my reporting was only listing dev, deploy was there also.
I've got things running again by using environment variables rather than properties files for profiles, but I'd like to get everything setup with just the files...