Announcement Announcement Module
No announcement yet.
Pointcut not working Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pointcut not working

    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>

    <aop:config proxy-target-class="true">
    <aop:aspect ref="mylogger">

    <aopointcut id="sayHelloPointCut" expression="execution(* sayHello(..))"/>
    <aop:before method="printBefore" pointcut-ref="sayHelloPointCut"/>

  • #2
    The example works fine for me. You can post the whole test-case here (java classes and spring config), I'll check.