I am using @PropertySource to configure a Configuration class:
@Configuration
@PropertySource("classpath:/mongo-${env}.properties")
public class MongoConfiguration {
mongo-${env}.properties files are located in the classpath. This works fine.
I am now externalizing configuration to Git with Spring Cloud Config: All application.yml files have been migrated. However I don't know if it is possible and how to externalize property files like the one declared in @PropertySource.
What I did: I tried to rename mongo-prod.properties to application-prod.properties in Git. Then I changed the @PropertySource to:
@PropertySource("file:///C://.../config-repo/application-prod.properties")
which is the local copy of the repository. This works but this is just an hardcoded solution.
Is there a cleaner solution?