问题由来:

   springboot引入了多个JdbcTemplate,但是就是注册不了这几个Bean,启动报错,信息如下

。。。。。。。

Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving overridden method "com.gysoft.gyproduct.dao.impl.VersionControlDaoImpl$$EnhancerBySpringCGLIB$$12e0126c.pageQuery(Lcom/gysoft/bean/jdbc/Page;)Lcom/gysoft/bean/jdbc/PageResult;" the class loader (instance of org/springframework/boot/devtools/restart/classloader/RestartClassLoader) of the current class, com/gysoft/gyproduct/dao/impl/VersionControlDaoImpl$$EnhancerBySpringCGLIB$$12e0126c, and its superclass loader (instance of sun/misc/Launcher$AppClassLoader), have different Class objects for the type com/gysoft/bean/jdbc/Page used in the signature
	at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:217) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:109) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:466) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:349) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:298) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1633) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	... 49 common frames omitted
Caused by: java.lang.LinkageError: loader constraint violation: when resolving overridden method "com.gysoft.gyproduct.dao.impl.VersionControlDaoImpl$$EnhancerBySpringCGLIB$$12e0126c.pageQuery(Lcom/gysoft/bean/jdbc/Page;)Lcom/gysoft/bean/jdbc/PageResult;" the class loader (instance of org/springframework/boot/devtools/restart/classloader/RestartClassLoader) of the current class, com/gysoft/gyproduct/dao/impl/VersionControlDaoImpl$$EnhancerBySpringCGLIB$$12e0126c, and its superclass loader (instance of sun/misc/Launcher$AppClassLoader), have different Class objects for the type com/gysoft/bean/jdbc/Page used in the signature
	at java.lang.Class.forName0(Native Method) ~[na:1.8.0_172]
	at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_172]
	at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:467) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:492) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:114) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:480) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:337) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:55) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:201) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
	... 56 common frames omitted

解决方案:

     pom.xml中把spring-boot-devtools依赖注释掉!

 

具体为什么要spring-boot-devtools依赖注释

https://blog.csdn.net/m0_38043362/article/details/78064539

 

GitHub 加速计划 / de / devtools
24.59 K
4.14 K
下载
vuejs/devtools: Vue.js 开发者工具,这是一个浏览器插件,可以安装在 Chrome 和 Firefox 等现代浏览器中,用于调试 Vue 应用程序,提供了组件树查看、状态快照、时间旅行等高级调试功能。
最近提交(Master分支:2 个月前 )
79116147 - 3 个月前
f0359002 - 4 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐