spring
哈夫热曼
Java开发
展开
-
Requested bean is currently in creation: Is there an unresolvable circular reference循环注入问题的解决
今天在在项目中新增了一个服务,然后启动该服务,spring容器初始化报错:循环依赖,错误信息如下:Requested bean is currently in creation: Is there an unresolvable circular reference?折腾了三个小时,特此记录一下!错误的原因大概是:新增该服务之前,服务A已经注入了服务C中的bean,现在新增的服务B也要注入服务C中的同一个bean。此时服务A已经启动,如果再启动服务B,就会报错了。问题解决:Spring中的 @La原创 2020-11-29 02:08:34 · 27539 阅读 · 1 评论 -
Failed to bind properties under ‘‘ to com.zaxxer.hikari.HikariDataSource
服务启动报文章标题错误,可能是.yml文件中忘了配置数据库的驱动例如mysql数据库,则添加:spring: datasource: driver-class-name: com.mysql.jdbc.Driver原创 2020-11-28 21:00:55 · 692 阅读 · 0 评论 -
连接Mysql时出现警告Establishing SSL connection without server‘s identity verification is not recommende
错误WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with exis原创 2020-11-07 11:12:19 · 366 阅读 · 0 评论 -
如何用Swagger 2生成接口文档
基于springboot + swagger 生成接口文档1.基于springboot环境 添加swagger依赖: 在web模块添加<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version></dependency>原创 2020-11-07 10:45:40 · 1246 阅读 · 0 评论 -
@Component和@Configuration作为配置类的差别
使用Configuration时在driver和spring容器之中的是同一个对象,而使用Component时是不同的对象。造成不同结果的原因在ConfigurationClassPostProcessor类之中,通过调用enhanceConfigurationClasses方法,为被注解@Configuration的类进行CGLIB代理。虽然Component注解也会当做配置类,但是并不会为其生成CGLIB代理Class...原创 2020-10-30 17:56:30 · 143 阅读 · 0 评论 -
MyBatis注解开发-@Insert和@InsertProvider
首先,在mybatis-generator.xml中配置返回主键UserMapper中的@SelectKey:返回主键,具体解释见下面说明@InsertProvider:type指明SQL工厂类,method是工厂类里对应的方法@SelectKey注解源码statement是要运行的SQL语句,它的返回值通过resultType来指定before表示查询语句statement运行的时机keyProperty表示查询结果赋值给代码中的哪个对象,keyColumn表示将查询结果赋值给数据库表原创 2020-09-17 20:58:00 · 6349 阅读 · 0 评论