Spring Boot Profile Profile Properties
I am using Sprint Boot and want to have multiple profile specific properties files. Status of documents:
In addition to application.properties files, specific property profiles can also be defined using the APPLICATION- {profile} .properties naming convention.
http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-external-config-profile-specific-properties
However, I have multiple properties files (for example db.properties
). I am currently downloading this non-core file as:
@Configuration
@PropertySource( {"classpath:db.properties"} )
class DataSourceConfig {
@Value("db.server") String server;
...
}
How can I combine these two things together, so it loads db-dev.properties
like Spring Boot forapplication.properties
It looks like it should be easy, but I can't figure out how to do it?
Java -jar my-spring-boot.jar - spring.profiles.active = test you can set profile.active = your environment using command line
I just saw what you are using @PropertySource
. the docs say:
Both application.properties (or application.yml) defined by a profile and files referenced via @ConfigurationProperties are considered uploaded files.