• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown

Needs help for a simple AoP application with Spring

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my very first time to use Spring. I'm having trouble in my AoP implementation. What I�m doing is simple: one interface called Knight with one method getMyFavouratePizza(), the implementation of this interface is KnightImpletation. To feel Spring's AoP, I am going to add a simple logging feature to the getMyFavouratePizza() method by AoP, therefore, I use MethodBeforeAdvice interface here. But the result is frustrating. It seems that the AoP has never been invoked by Spring. The following is my xml configuration file: (note: I'm using NameMatchMethodPointcut for the PointCut, but when I change to RegexpMethodPointcutAdvisor, it's the same. Nothing happens.)

Just wondering if miss anything here. Or could anyone help me out?

<?xml version="1.0" encoding="UTF-8"?>
<bean id="knightTarget" class="com.knight.KnightImpletation">
<property name="pizzaStrore">
<ref local="pizzaMaker"/>

<bean id="pizzaMaker" class="com.knight.DominoPizza">

<bean id="knightLogAdvice" class="com.knight.KnightBeforeInterceptor"/>

<bean id="knightLogAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcut">
<property name="mappedName">
<property name="advice">
<ref bean="knightLogAdvice"/>

<bean id="knight" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<property name="interceptorNames">
<ref bean="knightLogAdvisor"/>
<property name="target">
<ref bean="knightTarget"/>

Paper beats rock. Scissors beats tiny ad.
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic