nacos-group / nacos-spring-boot-project

Nacos ECO Project for Spring Boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@NacosValue没有优先读nacos的配置

seeping007 opened this issue · comments

使用 @NacosValue(包括@value)注解,若本地application.yaml有相应配置,则不会读nacos上的配置,需要把application.yaml对应配置去掉才行。

nacos-config-spring-boot-starter 0.2.10版本没有这个问题。是因为版本不匹配?还是说配置上有了一定变更?

相应版本如下:

  • nacos-server:2.1.0
  • nacos-config-spring-boot-starter:0.2.12
  • springboot:2.7.3(2.6.3)
  • springcloud:2021.0.3(2021.0.1)
  • jdk:17

bootstrap.yaml相关配置:

nacos:
  config:
    enabled: true
    bootstrap:
      enable: true
    max-retry: 10
    auto-refresh: true
    remote-first: true
    type: yaml

用官方推荐的方式,不使用bootstrap引入就可以(nacos.config移到application.yaml)