orgspringframeworkbeansfactoryBeanNotOfRequiredTypeException Bean named accountServiceImpl is expected to be of type aJXserviceimplAccountServiceImpl but was actually of type jdkproxy2$Proxy22
This exception is thrown when Spring tries to autowire a bean and the actual type of the bean does not match the expected type. In this case, the bean named 'accountServiceImpl' is expected to be of type 'aJX.service.impl.AccountServiceImpl', but it was actually of type 'jdk.proxy2.$Proxy22'.
This means that Spring created a proxy object for the 'accountServiceImpl' bean, instead of the actual implementation class. This can happen when you use AOP (Aspect Oriented Programming) with Spring, which creates proxy objects to intercept method calls and add additional behavior.
To fix this issue, you can either change the expected type of the bean to 'jdk.proxy2.$Proxy22', or you can modify your configuration so that Spring does not create a proxy object for the 'accountServiceImpl' bean. One way to achieve this is by using the 'proxy-target-class' attribute in the aop:config element of your Spring configuration file. Set this attribute to 'true' to force Spring to use CGLIB proxies instead of JDK dynamic proxies
原文地址: https://www.cveoy.top/t/topic/goyn 著作权归作者所有。请勿转载和采集!