Results 1 to 2 of 2

Thread: Pointcut not working

  1. #1
    Join Date
    Sep 2008
    Posts
    1

    Default 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>
    </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>

  2. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •