1、坑1 api中feignclient中的名字@FeignClient(name = "****") 和 该微服务名字不一样,调用api 会报feign.FeignException$ServiceUnavailable: [503 Service Unavailable] during GET …解决方法: name = "user-server" 的名字要和 application.yaml中spring: application: name: user-server 一样
2、坑2 application.yaml中配置mybatis的mapper-locations,引入其他模块中的mapper.xml文件mapper-locations: classpath:mybatis/mappers/*.xml 不加* 会导致 Invalid bound statement (not found) 解决方法: 将原来的 mapper-locations: classpath:mybatis/mappers/*.xml 替换为 mapper-locations: classpath*:mybatis/mappers/*.xml
3、 坑3 搭建微服务 springboot和springcloud的版本要对应,否则会报错
4、 坑4 执行maven install的时候 当执行到test命令时会报maven-surefire相关的错解决方法
在pom文件加入下面这个
org.apache.maven.plugins maven-surefire-plugintrue
5、坑5 执行maven install的时候会报错 spring-boot-maven-plugin解决方法: 在启动类的pom文件中加入
org.springframework.boot spring-boot-maven-plugin其他非启动类模块的pom文件,不要加入这个
6、 坑6 启动服务,springboot启动报错Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary...解决方法: idea中菜单栏 Build —> Rebuild Project 即可
7、 坑7 使用druid 配置多数据源 和flyway兼容问题解决方法:见
Flyway配置(包含多数据源配置)及使用规范_beautyofmath的博客-CSDN博客
8、坑8 配置多数据源,一定要注意各个配置项相互对应
9、spring-boot-admin-starter 和 spring-boot-starter-actuator关系1、都是用来监控微服务的
2、spring-boot-admin-starter 中已经集成了 spring-boot-starter-actuator
SBA 全称 Spring Boot Admin 是一个管理和监控 Spring Boot 应用程序的开源项目。分为admin-server 与 admin-client 两个组件,admin-server通过采集 actuator 端点数据,显示在 spring-boot-admin-ui 上,已知的端点几乎都有进行采集,通过 spring-boot-admin 可以动态切换日志级别、导出日志、导出heapdump、监控各项指标 等等….
Spring Boot Admin 在对单一应用服务监控的同时也提供了集群监控方案,支持通过eureka、consul、zookeeper等注册中心的方式实现多服务监控与管理…



