I am running spring-boot on an embedded tomcat server through maven with mvn clean install spring-boot:run
. But every time I run it I get this error:
In my case, in IntelliJ, I used a different profile. So choosing a dev profile in my case, solved an issue.
If the above changes in pom.xml
file still doesn't solve the problem try below option.
Add the @PropertySource
annotation at the top of your class
@PropertySource(
{
"classpath:/application.properties",
"classpath:/${spring.profiles.active}/application-${spring.profiles.active}.properties"
}
)
If that still doesn't solve try adding the following annotation
@EnableAutoConfiguration
Salam
I was missing the below dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
I need read config values for ceneralized config server .