1. Problem Description:

When the microservice project (SpringCloud + Springboot) uses Nacos as the configuration center, the configuration file in Naocs is not read

2. Causes of the problem:

The springboot project configuration file bootstrap.yml (bootstrap.properties) was not read (this is the file in the Nacos configuration center of the project configuration).

3. Problem solving:

The root cause is that the version of Springboot is too high. Here’s a solution:

  1. Change the springBoot version to 2.1.8.RELEASE:
  2. Add the dependent
  • Previous versions of Spring Cloud 2.4
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-context</artifactId>
</dependency>
Copy the code
  • higher
 <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
Copy the code