Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The difference between spring boot configuration bootstrap.yml and application.yml

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "the difference between bootstrap.yml and application.yml in spring boot configuration". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the difference between bootstrap.yml and application.yml in spring boot configuration.

Format of the 1.spring boot configuration file

Properties format

Yaml format

There is a flaw in spring for configuration files in yaml format. The @ PropertySource annotation does not support reading yaml configuration files, only properties configuration files. However, this problem can be read from the yaml configuration item by using the @ Value annotation.

The difference between 2.bootstrap.yml and application.yml

The bootstrap configuration file is a new startup configuration file for spring cloud, and the spring-cloud-context dependency needs to be introduced before it is loaded.

Bootstrap is loaded by the parent ApplicationContext, so it takes precedence over application

Because bootstrap takes precedence over application loading, it will not be overwritten

When using the configuration center spring cloud config, you need to configure the address of the configuration center in the bootstarp, so that when the parent ApplicationContext loads, the corresponding configuration is pulled from the configuration center to the application.

Thank you for your reading, the above is the content of "the difference between spring boot configuration bootstrap.yml and application.yml". After the study of this article, I believe you have a deeper understanding of the difference between spring boot configuration bootstrap.yml and application.yml, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report