内容简介:使用bootstrap然后定义好扩展名,因为在nacos里我们添加的是yaml文件,,只它默认只查询 properties文件bootstrap.ymlbootstrap-dev.yml
配置文件问题
如果使用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做为本地配置文件的名称。
以上所述就是小编给大家介绍的《springcloud~nacos在使用中需要注意的问题》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Algorithms and Data Structures
Kurt Mehlhorn、Peter Sanders / Springer / 2008-08-06 / USD 49.95
Algorithms are at the heart of every nontrivial computer application, and algorithmics is a modern and active area of computer science. Every computer scientist and every professional programmer shoul......一起来看看 《Algorithms and Data Structures》 这本书的介绍吧!