Spring bootstrap.yml 不管用,失效解決方案(spring cloud 2020.x.x)
升級spring cloud版本之后發現bootstrap.yml 失效了,閱讀官方文檔得知,需要新增一個引用來開啟bootstrap.xml文件的讀取,新版spring cloud默認是關閉讀取了。
增加依賴如下即可:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
官方文檔:
https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#config-first-bootstrap

posted on 2021-12-01 10:29 paulwong 閱讀(681) 評論(0) 編輯 收藏 所屬分類: SPRING CLOUD