zoukankan      html  css  js  c++  java
  • springcloud~nacos在使用中需要注意的问题

    配置文件问题

    如果使用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
    

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

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

  • 相关阅读:
    TreeMap<K,V>类
    2020-3-7学习地图
    Thread类
    Redis-Windows中注册Redis后台守护进程
    Redsi-(error) NOAUTH Authentication required.
    2020-3-6学习地图
    Collection<E>接口
    Map<K,V>接口
    Set接口
    List类
  • 原文地址:https://www.cnblogs.com/lori/p/13376032.html
Copyright © 2011-2022 走看看