java后端自学错误总结spring持续更新中

java后端自学错误总结

一.SpringBoot--正在总结中

1.循环嵌套异常

今天再写SpringCloud项目的时候书写测试类运行结果报错了报错的最后的信息是

java 复制代码
The dependencies of some of the beans in the application context form a cycle:
 
    newsConfigController (field private com.shengkong.article.service.newsConfigService com.shengkong.article.controller.v1.newsConfigController.newsConfigService)
      ↓
   newsConfigServiceImpl (field protected com.baomidou.mybatisplus.core.mapper.BaseMapper com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.baseMapper)
      ↓
   newsConfigMapper defined in file [E:\shengkong\shengkongtoutiao\shengkong_news\shengkong_news-view\target\classes\com\shengkong\article\mapper\NewsConfigMapper.class]
      ↓
   sqlSessionFactory defined in class path resource [com/shengkong/seata/config/DataSourcesProxyConfig.class]
┌─────┐
|  dataSourceProxy defined in class path resource [com/shengkong/seata/config/DataSourcesProxyConfig.class]
↑     ↓
|  druidDataSource defined in class path resource [com/shengkong/seata/config/DataSourcesProxyConfig.class]
↑     ↓
|  org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker
 Error creating bean with name 'druidDataSource' defined in class path resource [com/shengkong/seata/config/DataSourcesProxyConfig.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'dataSourceProxy': Requested bean is currently in creation: Is there an unresolvable circular reference?

项目里面我是继承了mybatis-plus

看到这个报错的时候优先排查了一下mapper.xml的文件里面是否出现了类名路径书写错误排查了没有

然后又去查看了启动类注解里面的MapperScan注解对应的mapper文件路径是不是有问题,查看了还是没问题

排查到这里以后我就看了ctrl+alt+shift+u 查看了对应的关系发现还是没有什么循环依赖的问题

排查到这里有点崩溃了因为技术水平不够实在找不到哪里出了问题,希望有知道的大佬们可以解答一下---------炸裂炸裂炸裂

最后我是再启动类上加了

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})

才让测试类的启动正常的

2.项目起来卡住了怎么办

这个时候可以考虑看看是不是idea的断点导致的可以将断点取消掉再去重启项目,目前遇到这种情况

二.SpringCloud--正在总结中

相关推荐
Java成神之路-3 小时前
深入理解 HashMap 扩容时机:JDK 7 vs JDK 8 的设计差异与取舍
java·juc
李冰然3 小时前
深入Java集合框架:数组与List互转底层原理剖析(JDK 8)
java
竹枝溪3 小时前
MySQL进阶:约束、多表设计、多表查询与事务
java·数据库·mysql·事务·子查询·acid·多表查询
上玄code4 小时前
【Agent精讲】调一个LLMAPI背后的工程问题
java·开发语言·python·chatgpt
李冰然4 小时前
深入Java集合框架:ArrayList源码解析(JDK 8)
java
小小啊python4 小时前
IDEA中SpringBoot项目配置热部署
java·ide·intellij-idea·springboot·热部署
Java成神之路-4 小时前
Spring AI Alibaba 实现多轮对话记忆:ChatMemory 与 Redis 持久化实战
java·springaialibaba
JAVA面经实录9174 小时前
网络编程基础(Java Web/分布式前置·完整版)(十一)
java·前端·网络
代码方舟4 小时前
零信任架构实战:基于天远人企关联构建自动化企业尽职调查网关
java·人工智能·架构·自动化
Escalating_xu4 小时前
【Linux】基础 I/O 深度解析:FILE、文件描述符、open/read/write、重定向与缓冲区
java·linux·服务器