Hi, I am using JDK 1.4 and Spring 2.
I have tried simple example of AOP
I have an interface hello which has a method sayHello(String)
I implement this interface helloimpl and use proper setter/getter method and implement the method sayHello.
For the pointcut interceptor, I have a simple class called MyLogger with a method printBefore which just prints "executing before sayHello" to System.out.
I have tried running it on command line loading the helloimpl bean via ClassPathXMLApplicationContexg
It wires the beans correctly but doesn't intercept
My spring file is this
<bean id="mylogger" class="test.MyLogger"/>
<bean id="hello" class="test.helloimpl">
<property name="greeting">
<value>Good Morning</value>
</property>
</bean>
<aop:config proxy-target-class="true">
<aop:aspect ref="mylogger">
<aopointcut id="sayHelloPointCut" expression="execution(* sayHello(..))"/>
<aop:before method="printBefore" pointcut-ref="sayHelloPointCut"/>
</aop:aspect>
</aop:config>
</beans>


ointcut id="sayHelloPointCut" expression="execution(* sayHello(..))"/>
Reply With Quote