这里写自定义目录标题
springcloud无法注册nacos问题
最近在学习nacos的使用,按照官方文档写了一个SpringCloud+nacos的小demo,却发现注册进nacos注册中心,日志是这样的:
2019-10-15 13:25:04.960 WARN 16340 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-10-15 13:25:04.960 INFO 16340 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-10-15 13:25:05.059 INFO 16340 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-10-15 13:25:06.704 INFO 16340 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-10-15 13:25:06.784 INFO 16340 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8089 (http) with context path ''
2019-10-15 13:25:06.784 INFO 16340 --- [ main] com.nacos.demo.NacosServerApplication : Started NacosServerApplication in 8.895 seconds (JVM running for 10.14)
后来和网上的代码比对,发现我springboot的版本是2.1.9.RELEASE
降低到 2.0.8.RELEASE后就能注册了,和nacos的官网说明:版本 0.2.x.RELEASE 对应的是 Spring Boot 2.x 版本,版本 0.1.x.RELEASE 对应的是 Spring Boot 1.x 版本有些偏差。
编辑:
是springboot版本和springcloud版本没对应上,搞了个大乌龙