springcloud~nacos在使用中需要注意的问题

栏目: IT技术 · 发布时间: 5年前

内容简介:使用bootstrap然后定义好扩展名,因为在nacos里我们添加的是yaml文件,,只它默认只查询 properties文件bootstrap.ymlbootstrap-dev.yml

配置文件问题

如果使用application命名时,需要使用 Properties 扩展名的,如果使用 yml 格式的,那你不能使用application.yml,而应该使用bootstrap.yml这种格式,如图所示,这种是无法加载配置的

springcloud~nacos在使用中需要注意的问题 springcloud~nacos在使用中需要注意的问题

使用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
springcloud~nacos在使用中需要注意的问题

对于nacos上的配置文件,是可以没有扩展名的

springcloud~nacos在使用中需要注意的问题

总结 :在使用yaml配置文件时,我们需要使用bootstrap做为本地配置文件的名称。


以上所述就是小编给大家介绍的《springcloud~nacos在使用中需要注意的问题》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Introduction to Computation and Programming Using Python

Introduction to Computation and Programming Using Python

John V. Guttag / The MIT Press / 2013-7 / USD 25.00

This book introduces students with little or no prior programming experience to the art of computational problem solving using Python and various Python libraries, including PyLab. It provides student......一起来看看 《Introduction to Computation and Programming Using Python》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具