In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "springboot startup does not load bootstrap.yml file problem how to solve", in the daily operation, I believe that many people in springboot startup do not load bootstrap.yml file problem on how to solve the problem, editor consulted all kinds of information, sort out a simple and easy to use method of operation, hope to answer the "springboot startup does not load bootstrap.yml file problem how to solve" the doubt is helpful! Next, please follow the editor to study!
Springboot startup does not load bootstrap.yml files
Use nacos as the configuration center, but the program failed to start and did not pull the configuration information of the configuration center.
After inspection, it is found that the bootstrap.yml file has not been loaded, add the following dependency in the project pom.xml file, you may need to add the version number, the specific version number can go to the maven warehouse to query, I am using version 3.0.1.
Org.springframework.cloud spring-cloud-starter-bootstrap
Re-import the dependency, and then restart the project. You can see the following information in the project log, and the service started successfully, indicating that the service started successfully.
2021-03-07 22 b.c.PropertySourceBootstrapConfiguration 47 INFO 54020-[restartedMain] b.c.PropertySourceBootstrapConfiguration: Located property source: [BootstrapPropertySource {name='bootstrapProperties-xxx-xxx-dev.yml,dev'}, BootstrapPropertySource {name='bootstrapProperties-xxx-xxx.yml,dev'}, BootstrapPropertySource {name='bootstrapProperties-xxx-xxx,dev'}]
Unable to recognize bootstrap.yml small green leaf problem error message
Problem positioning
Generally, when you use Spring Boot alone, the bootstrap.yml file generally will not take effect, that is, there is no small green leaf icon; if you use the Spring Cloud component bootstrap.yml will take effect, you need to introduce spring-cloud-commons-dependencies as a package dependency. In addition, the loading order of bootstrap.yml takes precedence over application.yml.
Solve
Solution 1: you can introduce a component of Spring Cloud, such as Eureka or Feign, because it contains spring-cloud-commons-dependencies dependencies.
Org.springframework.cloud spring-cloud-starter-netflix-eureka-client
Option 2: introduce spring-cloud-commons-dependencies dependency separately
Org.springframework.cloud spring-cloud-commons-dependencies ${spring-cloud-commons.version} at this point, the study on "how to solve the problem of not loading bootstrap.yml files when springboot starts" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.