升級spring cloud版本之后發(fā)現(xiàn)bootstrap.yml 失效了,閱讀官方文檔得知,需要新增一個引用來開啟bootstrap.xml文件的讀取,新版spring cloud默認是關閉讀取了。
增加依賴如下即可:
<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