SpringBoot出现Error creating bean with name ‘xxxServiceImpl‘: Lookup method resolution failed;解决方法

时间:2025-03-20 10:33:21

今天在写SpringBoot项目的时候,报了以下错误

: Error creating bean with name 'xxxServiceImpl': Lookup method resolution failed; nested exception is : Failed to introspect Class [] from ClassLoader [$AppClassLoader@682a0b20]
	at (:265) ~[spring-beans-5.1.:5.1.]
	at (:1269) ~[spring-beans-5.1.:5.1.]
	at (:1184) ~[spring-beans-5.1.:5.1.]
	at (:555) ~[spring-beans-5.1.:5.1.]
	at (:515) ~[spring-beans-5.1.:5.1.]
	at $doGetBean$0(:320) ~[spring-beans-5.1.:5.1.]
	at (:222) ~[spring-beans-5.1.:5.1.]
	at (:318) ~[spring-beans-5.1.:5.1.]
	at (:199) ~[spring-beans-5.1.:5.1.]
	at (:843) ~[spring-beans-5.1.:5.1.]
	at (:877) ~[spring-context-5.1.:5.1.]
	at (:549) ~[spring-context-5.1.:5.1.]
	at (:775) ~[spring-boot-2.1.:2.1.]
	at (:397) ~[spring-boot-2.1.:2.1.]
	at (:316) ~[spring-boot-2.1.:2.1.]
	at (:127) [spring-boot-test-2.1.:2.1.]
	at (:99) [spring-test-5.1.:5.1.]
	at (:117) [spring-test-5.1.:5.1.]
	at (:108) [spring-test-5.1.:5.1.]
	at (:54) [spring-boot-test-autoconfigure-2.1.:2.1.]
	at (:47) [spring-boot-test-autoconfigure-2.1.:2.1.]
	at (:246) [spring-test-5.1.:5.1.]
	at .junit4.(:227) [spring-test-5.1.:5.1.]
	at .junit4.SpringJUnit4ClassRunner$(:289) [spring-test-5.1.:5.1.]
	at (:12) [junit-4.:4.12]
	at .junit4.(:291) [spring-test-5.1.:5.1.]
	at .junit4.(:246) [spring-test-5.1.:5.1.]
	at .junit4.(:97) [spring-test-5.1.:5.1.]
	at $(:290) [junit-4.:4.12]
	at $(:71) [junit-4.:4.12]
	at (:288) [junit-4.:4.12]
	at $000(:58) [junit-4.:4.12]
	at $(:268) [junit-4.:4.12]
	at .(:61) [spring-test-5.1.:5.1.]
	at .(:70) [spring-test-5.1.:5.1.]
	at (:363) [junit-4.:4.12]
	at .junit4.(:190) [spring-test-5.1.:5.1.]
	at ..(:89) [.cp/:na]
	at (:41) [.cp/:na]
	at (:541) [.cp/:na]
	at (:763) [.cp/:na]
	at (:463) [.cp/:na]
	at (:209) [.cp/:na]
Caused by: : Failed to introspect Class [] from ClassLoader [$AppClassLoader@682a0b20]
	at (:507) ~[spring-core-5.1.:5.1.]
	at (:404) ~[spring-core-5.1.:5.1.]
	at (:389) ~[spring-core-5.1.:5.1.]
	at (:248) ~[spring-beans-5.1.:5.1.]
	... 42 common frames omitted

看的我一脸懵逼啊,上面写的都是Spring的错误,都没写到我代码里面哪里错了,但是Spring就是创建不了这个Bean。在网上找了一大堆文章,又仔细检查了自己的代码,还把代码变成了最简单的Service,里面什么业务都没写都报错,真的是折磨人!

后来经过不断的摸索,探索,艰苦卓绝各种试验,终于解决了!

原来是项目依赖的问题,项目本来用的是项目依赖,结果就出现了这样的问题。

后来把要依赖的项目打成jar包,再在maven的pom文件里面定义就可以了

如果谁遇到这样的问题可以考虑以下是否是因为这个原因!