I'm using Sprint Boot, and would like to have multiple profile specific property files. The docs state:
In addition to application.properties files, profile specific properties can also be defined using the naming convention application-{profile}.properties.
However I have multiple properties files (e.g. db.properties
). I'm loading currently load this non-profile specific 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 does for application.properties
It sounds like it should be easy, but I can't work out how to do it?!
@PropertySource
you would need to define one per profile with an explicit file path. (In short if you are using Spring Boot,@PropertySource
might not be the right tool, but YMMV.) – Dave Syer