Reputation: 401
I am facing an issue while trying to start Config Client with the below dependency:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
The placeholder i am trying to get is the Environment variable which will help me pick up the files from config server. E.g config-client-{ENVIRONMENT}.properties
Exception: java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'ENVIRONMENT' in value "${ENVIRONMENT}"
Upvotes: 0
Views: 447
Reputation: 981
In Spring Boot ${ENVIRONMENT} does not come out of box.
You have two options.
Set ENVIRONMENT= in all application.yml files. So you can get it at run time.
Fetch the file config-client-${spring.profiles.active}.properties so it will get the property file as per the spring profile.
Upvotes: 1