私は default-context.xml を持っています
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
<!-- some other beans -->
<bean id="licenseTestingAdvice" class="mypackage.LicenseTestingAdvice" />
<bean id="jdbcTemplate" class="mypackage.ProxyFactoryBean">
<property name="interceptorNames">
<list>
<idref bean="licenseTestingAdvice" />
</list>
</property>
<property name="target">
<value>mypackage.JDBCTemplate</value>
</property>
<property name="proxyTargetClass" value="true" />
</bean>
そして、LicenseTestingAdvice.java:
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import java.lang.reflect.Method;
public class LicenseTestingAdvice implements MethodInterceptor {
@Override
public Object invoke(MethodInvocation inv) throws Throwable {
Method method = inv.getMethod();
System.out.println(String.format(">> Method %s was called before", method.getName()));
inv.proceed();
System.out.println(String.format(">> Method %s was called after", method.getName()));
return null; //To change body of implemented methods use File | Settings | File Templates.
}
}
JDBCTemplate クラスの execute() メソッドを呼び出すと、invoke() メソッドが呼び出されません。これを修正する方法は?