Spring

 Load properties using Config Server with different property file name

Somnath Guha's profile image
Somnath Guha posted Aug 30, 2019 04:19 AM

I want load application properties using spring boot config server using file system from my application which is config client to communicate with community server. I am able to read config files like {appname}{profile}.properties using my code. But as per the requirement I need to read properties files with the file name as {appname}.properties.{profile}. I want to know is there any way around to resolve this problem?

Daniel Mikusa's profile image
Daniel Mikusa

Config Server is pretty flexible, but I don't think you can change the pattern to an arbitrary value. My understanding is that you can use the following patterns (for a Git backend):

/{application}/{profile}[/{label}] /{application}-{profile}.yml /{label}/{application}-{profile}.yml /{application}-{profile}.properties /{label}/{application}-{profile}.properties

https://cloud.spring.io/spring-cloud-static/spring-cloud-config/2.1.4.RELEASE/single/spring-cloud-config.html#_quick_start