- The bean ‘xx.FeignClientSpecification’ could not be registered. A bean with that name has already been defined and overriding is disabled.

起因:springboot从1.5升级到2.2.4
原因:在使用相同名称的FeigClient注解时,注入到Ioc的是相同Bean名。所以错误是由FeignClientSpecification类引起的
解决:添加如下配置,在spring boot2.1之前该配置默认为true,2.1开始默认false,更好的解决方案是尽量取消相同命名
spring:main:allow-bean-definition-overriding: true
- java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvider
起因:springboot 1.x升级到 2.x
原因:druid数据源版本不兼容
解决:升级版本到1.1.10
<dependency><groupId>com.alibaba</groupId><artifactId>druid-spring-boot-starter</artifactId><version>1.1.10</version></dependency>
- java.sql.SQLException: The server time zone value ‘?й???ʱ?’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the ‘serverTimezone’ configuration property) to use a more specifc time zone value if you want to utilize time zone support.

起因:springboot1.x 升级到 2.x
原因:版本不兼容,显示新版本的数据库连接程序需要指定UTC时区
解决:改正方法将配置文件中的“url”后面加上指定的时区,&serverTimezone=GMT
<!--改之前-->jdbc.driverClass = com.mysql.cj.jdbc.Driverjdbc.url = jdbc:mysql://127.0.0.1:3306/db?useUnicode=true&characterEncoding=utf8jdbc.username = rootjdbc.password = root123<!--改之后-->jdbc.driverClass = com.mysql.cj.jdbc.Driverjdbc.url = jdbc:mysql://127.0.0.1:3306/db?useUnicode=true&characterEncoding=utf8&serverTimezone=GMTjdbc.username = rootjdbc.password = root123
- Bean with name ‘xxx’ has been injected into other beans [xxx] in its raw version as part of a circular reference

Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘homeworkSubmitServiceImpl’: Bean with name ‘homeworkSubmitServiceImpl’ has been injected into other beans [homeworkEvaluateServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using ‘getBeanNamesOfType’ with the ‘allowEagerInit’ flag turned off, for example.
起因:
原因:springIoC异常,循环依赖,即A注入了B,B又注入了A,导致异常
解决:使用@Lazy注解,取消注入预初始化,或使用setter方法注入
- Configuration property name ‘sharding.jdbc.datasource.xiao_comment’ is not valid:
Invalid characters: ‘_’
Bean: servletEndpointRegistrar
Reason: Canonical names should be kebab-case (‘-‘ separated), lowercase alpha-numeric characters and must start with a letter

起因:springboot 1.x升级到 2.x
原因:springboot2.x造成,sharding jdbc建议使用-代替_,不支持下划线命名
解决:修改命名
