nacos配置无法读取到value

问题遇到的现象和发生背景

nacos配置的练习,能识别到配置文件-located property source。但无法在controller中识别value的值。很奇怪

用代码块功能插入代码,请勿粘贴截图

配置文件bootstarp


spring:
  application:
    name: userservice
  profiles:
    active: dev
  cloud:
    nacos:
      server-addr: localhost:8848
      config:
        file-extension: yaml

nacos配置
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/220941759966196.png "#left")

运行结果及报错内容

这是日志,发现能定位到配置文件,但是controller类读取不到yaml配置中的数据



12-02 12:16:29:974  WARN 16800 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[userservice] & group[DEFAULT_GROUP]
12-02 12:16:29:977  WARN 16800 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[userservice.yaml] & group[DEFAULT_GROUP]
12-02 12:16:29:980  WARN 16800 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[userservice-dev.yaml] & group[DEFAULT_GROUP]
12-02 12:16:29:980  INFO 16800 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-userservice-dev.yaml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-userservice.yaml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-userservice,DEFAULT_GROUP'}]

 Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'user.age' in value "${user.age}"
我的解答思路和尝试过的方法

缩进,换配置名

我想要达到的结果

能应用映射配置中的数据

已解决。。。 namespace的问题。