說(shuō)明:
在SpringBoot 2.4.x版本之后,對(duì)于bootstrap.properties/bootstrap.yaml配置文件的支持,需要導(dǎo)入如下依賴(lài):
<!-- 支持 bootstrap.properties 或 bootstrap.yml 配置文件 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>3.1.3</version>
</dependency>
注意:
1、導(dǎo)入依賴(lài)后,還需要開(kāi)啟?spring.cloud.bootstrap.enabled=true
2、spring cloud starter alibaba nacos config,引用這個(gè)配置中心的依賴(lài)后,需要使用bootstrap.yml或bootstrap.properties?作為中轉(zhuǎn)配置文件文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-638601.html
3、不同類(lèi)型配置文件讀取優(yōu)先級(jí):bootstrap.yml/bootstrap.properties > application.yml/application.properties文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-638601.html
到了這里,關(guān)于SpringBoot支持bootstrap.yml/bootstrap.properties配置文件,需要導(dǎo)入spring-cloud-starter-bootstrap依賴(lài)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!