在SpringCloud项目中配置会记录在配置中心,那么在项目启动时,要告诉程序配置中心在哪,此时就使用bootstrap.properties,它的启动顺序要早于application.properties
无法读取到bootstrap.properties
编译或install后,检查target里面没有bootstrap.properties,初步判定为maven编译时将该文件过滤了
解决方法
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.yml</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
以上配置表明在编译时需要包含以.properties类型的文件,.yml,.xml类似
重新编译即可解决问题