最近搭建SpringCloud架构,踩了不少坑,主要问题有以下这些:
一、SpringBoot无法启动,找不属性文件
DiscoveryClient_UNKNOWN/windows10.microdone.cn - was unable to refresh its cache! status = Cannot execute request on any known server
错误原因:
application.yml 文件找不到,见application.properties文件改成application.yml 即可
关于application.yml 与 application.properties区别,可以看我的另外一篇文章
https://blog.csdn.net/weixin_41003771/article/details/103086603
二、Hoxton 、Greenwich等版本
新建一个eureka模块后,发现怎么都启动不起来,springboot一直报错,经过多次查找,发现是SpringCloud和SpringBoot不匹配问题
SpringCloud有很多版本,不同版本,需要的SpringBoot版本也不一样,具体可参照以下:
spring-cloud:
"Finchley.M2": "Spring Boot >=2.0.0.M3 and <2.0.0.M5",
"Finchley.M3": "Spring Boot >=2.0.0.M5 and <=2.0.0.M5",
"Finchley.M4": "Spring Boot >=2.0.0.M6 and <=2.0.0.M6",
"Finchley.M5": "Spring Boot >=2.0.0.M7 and <=2.0.0.M7",
"Finchley.M6": "Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1",
"Finchley.M7": "Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2",
"Finchley.M9": "Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE",
"Finchley.RC1": "Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE",
"Finchley.RC2": "Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE"