alibaba / spring-cloud-alibaba

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
https://sca.aliyun.com
Apache License 2.0
27.83k stars 8.31k forks source link

nacos官网接入springcloud示例运行失败 #682

Closed liucyu closed 5 years ago

liucyu commented 5 years ago

步骤

bootstrap.properties:

spring.application.name=nacos-config spring.cloud.nacos.config.server-addr=127.0.0.1:8848

image 日志 2019-05-29 16:44:12.704 INFO 65456 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='nacos-config.properties'}]}

代码 image

结果 image __

fangjian0423 commented 5 years ago

Which version of spring cloud alibaba and nacos server are you using?

liucyu commented 5 years ago

版本 springboot 2.1.4.RELEASE springcloud Greenwich.SR1 spring-cloud-starter-alibaba-nacos-config 0.2.1.RELEASE @fangjian0423

fangjian0423 commented 5 years ago

Spring Cloud Greenwich should use spring-cloud-starter-alibaba-nacos-config 0.9.0.RELEASE, refer https://github.com/spring-cloud-incubator/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E.

liucyu commented 5 years ago

image @fangjian0423 still not work....

fangjian0423 commented 5 years ago

hi, did you solve it?

I think you can debug in NacosPropertySourceLocator to see what happened if didn't solve it.

tale2009 commented 3 years ago

NacosPropertySourceLocator.loadApplicationConfiguration当使用loadNacosDataIfPresent你会发现我们的dataid会被修改成dataid.file-extension,所以用nacos新建配置的时候命名要是nacos-config.properties