22
springcloud~nacos在使用中需要注意的问题
source link: http://www.cnblogs.com/lori/p/13376032.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
配置文件问题
如果使用application命名时,需要使用 Properties
扩展名的,如果使用 yml
格式的,那你不能使用application.yml,而应该使用bootstrap.yml这种格式,如图所示,这种是无法加载配置的
使用bootstrap然后定义好扩展名,因为在nacos里我们添加的是yaml文件,,只它默认只查询 properties文件
bootstrap.yml
server.port: 6060 spring: application.name: gateway profiles.active: dev
bootstrap-dev.yml
spring: cloud: nacos: config: server-addr: 127.0.0.1:8848 file-extension: yaml discovery: server-addr: 127.0.0.1:8848
对于nacos上的配置文件,是可以没有扩展名的
总结 :在使用yaml配置文件时,我们需要使用bootstrap做为本地配置文件的名称。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK