aspectj - spring aop - exception while creating advice around JdbcTemplate methods -


i've web application uses apache dbcp , spring jdbc perform database operations on oracle database. need write performance logger logs individual times of each database operation. tried writing around advice on 'execute' methods of org.springframework.jdbc.core.jdbctemplate results in error when spring gets initialized. logger class , exception stacktrace follows:-

i tried use cglib proxies enabling errors out on dao classes extends spring's storedprocedure class , use constructor injection.

@aspect public class logger {  @around("this(org.springframework.jdbc.core.jdbctemplate) && execution(* execute(*))") public object invoke(proceedingjoinpoint pjp) throws throwable {     long time = system.currenttimemillis();     object result = pjp.proceed();     logger.debug("time consumed = " + (system.currenttimemillis() - time));     return result; } 

exception stacktrace:

severe: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'mydao' defined in class path resource [spring/my-dao.xml]: unsatisfied dependency expressed through constructor argument index 0 of type [org.springframework.jdbc.core.jdbctemplate]: not convert constructor argument value of type [$proxy7] required type [org.springframework.jdbc.core.jdbctemplate]: failed convert value of type '$proxy7 implementing org.springframework.jdbc.core.jdbcoperations,org.springframework.beans.factory.initializingbean,org.springframework.aop.springproxy,org.springframework.aop.framework.advised' required type 'org.springframework.jdbc.core.jdbctemplate'; nested exception java.lang.illegalstateexception: cannot convert value of type [$proxy7 implementing org.springframework.jdbc.core.jdbcoperations,org.springframework.beans.factory.initializingbean,org.springframework.aop.springproxy,org.springframework.aop.framework.advised] required type [org.springframework.jdbc.core.jdbctemplate]: no matching editors or conversion strategy found @ org.springframework.beans.factory.support.constructorresolver.createargumentarray(constructorresolver.java:702) @ org.springframework.beans.factory.support.constructorresolver.autowireconstructor(constructorresolver.java:196) 


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -