I am trying to run simple example of MethodBeforeAdvice. For some reason, method calls are not intercepted. Any suggestions? thanks in advance.
Iitem is an interface. Book2 implements the interface.
Code:my xml: <!-- simple bean implements Iitem--> <bean id="book2" class="spring.test.Book2"/> <!-- The interceptor class --> <bean id="before" class="spring.test.LogBefore"/> <!--Proxying --> <bean id="something" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="proxyInterfaces"><value>spring.test.Iitem</value></property> <property name="target"><ref local="book2"/></property> <property name="interceptorNames"> <list> <value>before</value> </list> </property> </bean> code: public class MainApplication { public static void main(String[] args) { ApplicationContext ctx = new FileSystemXmlApplicationContext("spring/test/test-servlet.xml"); Iitem book2 = (Iitem)ctx.getBean("book2"); //somethig should happen here! book2.setName("book1"); System.out.println(book2.getName()); } }


Reply With Quote