spring没法启动常见缘由及排查方法

这里总结的问题,一般啥错误也不报,须要自个debug排查,固然每一个人遇到的问题多是不一样的,这里仅仅是我我的帮同事解决问题后的一些总结,可能网上的小伙伴可能也遇到,姑且简单记录一下:html

1. mybatis文件配置有问题,好比返回值类型写错了,或者sql语法有问题java

排查方法:在AbstractAutowireCapableBeanFactory#doCreateBean 中 几个catch中打断点差很少就能找到问题所在了,归根结底,其实也就是编码的时候仔细一点就好了,可是偶尔也会粗心,可是只要知道排查方法,啥也不惧

2. 仍是配置问题,好比mongo配置错了sql

 

排查方法:ConstructorResolver#autowireConstructor 断点到catch处
Error creating bean with name 'mongo' defined in class path resource [applicationContext-multi-datasource.xml]:
Unsatisfied dependency expressed through constructor argument with index 0 of type [com.mongodb.ServerAddress]:
Could not convert constructor argument value of type [com.mongodb.MongoClientURI] to required type [com.mongodb.ServerAddress]:
Failed to convert value of type 'com.mongodb.MongoClientURI' to required type 'com.mongodb.ServerAddress';
nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.mongodb.MongoClientURI] to required type [com.mongodb.ServerAddress]:
no matching editors or conversion strategy found

*****若是对您有帮助,支持一下-> 去打赏 *****
相关文章
相关标签/搜索