CGLib has no default constructor error when using spring AOP
I am trying to use AOP to log all method calls during method entry and exit using below bean and aop declaration in my beans xml,
<aop:config>
<aop:pointcut id="componentAnnotatedClass" expression="execution(* com.test.*.*.*(..))" />
<aop:advisor advice-ref="loggingAdvisor" pointcut-ref="componentAnnotatedClass" />
</aop:config>
<bean id="loggingAdvisor" class="org.springframework.aop.interceptor.CustomizableTraceInterceptor">
<property name="enterMessage" value="Entering $[targetClassShortName].$[methodName]($[arguments])" />
<property name="exitMessage" value="Leaving $[targetClassShortName].$[methodName](): $[returnValue], Total Execution Time : $[invocationTime]ms" />
</bean>
But when I use this, I get an exception like below,
Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.test.dao.BCommonDataAccessor]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
When I looked at this, I found out that cglib requries is the default constructor, but in my application, I have a parameterized constructor to input my data source. I cannot have a default constructor in my data accessory. Is there any hard question to deal with this problem. Note. I am using spring3.2 vesion
+3
source to share
No one has answered this question yet
Check out similar questions: