Let say my application.properties file of my microservice looks like this.
server.port=8023
spring.profiles.active=staging
spring.application.name=service-ws
spring.config.import=optional:configserver:http://my.cloud.config.server:8012/
What I try to achieve is, when I change "spring.profiles.active" to local, I need to use
spring.config.import=optional:configserver:http://localhost:8012/
As Config Server. Instead of
spring.config.import=optional:configserver:http://my.cloud.config.server:8012/
>Solution :
You need to use this format: application-{env}.properties
For example, for local environment: application-local.properties file will do the work.