Spring boot could not resolve placeholder in string

后端 未结 9 1099
悲哀的现实
悲哀的现实 2020-12-16 14:28

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:

         


        
相关标签:
9条回答
  • 2020-12-16 15:28

    In my case, in IntelliJ, I used a different profile. So choosing a dev profile in my case, solved an issue.

    0 讨论(0)
  • 2020-12-16 15:28

    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

    0 讨论(0)
  • 2020-12-16 15:29

    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 .

    0 讨论(0)
提交回复
热议问题