In the SpringBoot project, the bootstrap.properties file does not take effect

solution

The following dependencies need to be added:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-context</artifactId>
</dependency>

illustrate

When developing microservices, adding bootstrap files to other projects takes effect, but for a new project created today, this file does not take effect.

reason

Since the project is only in the initial development stage, there is no need to join the registration center. For the convenience of development, a springboot web project is directly started. So the appeal package is missing. So the bootstrap file will not take effect. Other projects generally use cloud components, for example, spring-cloud-starter-netflix-eureka-clientthis package also includes them spring-cloud-context.

Guess you like

Origin blog.csdn.net/fyk844645164/article/details/106749708