SpringCloud整合nacos配置中心读取不到yml

配置文件

  application:
    name: nacos-test-a
  cloud:
    nacos:
#      discovery:
#        server-addr: localhost:8848
#        username: nacos
#        password: nacos
#        service: nacos-test-a
      config:
        server-addr: localhost:8848
        username: nacos
        password: nacos
        prefix: nacos-test-a
        file-extension: yml
server:
  port: 8086

运行报错Error creating bean with name ‘testController’: Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘hero.name’ in value “${hero.name}”
原因,配置文件的编码格式不同
解决方法,SpringCloud整合nacos配置中心读取不到yml_第1张图片

你可能感兴趣的:(spring,cloud,java,spring)