Cannot proxy target class because CGLIB2 is not available

Cannot proxy target class because CGLIB2 is not available y: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
at org.springframework.aop.framework.DefaultAopProxyFactory.createAopProxy(DefaultAopProxyFactory.java:67)
at org.springframework.aop.framework.ProxyCreatorSupport.createAopProxy(ProxyCreatorSupport.java:106)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:490)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:365)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:325)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:361)
at org.springframework.beans.factory .support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1344)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
... 38 more



solutions:
1. Missing CGlib, put CGLIB Jar Just put the package into the project.
2. This error will also be reported when no interface is implemented!
Note: cglib does not contain asm, cglib-nodep contains asm, and asm is a necessary tripartite class library for cglib, the reason for the two versions is probably to avoid version conflicts during framework integration.
===================================================== ===================
Cannot convert value of type [$Proxy0 implementing org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework .aop.framework.Advised] to required type [dao.UserDaoImp] for property 'userDao': no ​​matching editors or conversion strategy found
You can see from the abnormally displayed information that Spring mainly converts proxy classes into interfaces when converting , instead of being cast to the actual class.
Solution:
1. If the transaction configured in the Spring configuration file is implemented through the AOP tag, add the proxy-target-class="true" attribute in <aop:config />.
2. Make the actual class implement an interface (UserDaoImp ​​implements the UserDao interface)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326662890&siteId=291194637