Yao Mingming

Greenhorn
+ Follow
since Dec 05, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Yao Mingming

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"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="knightTarget" class="com.knight.KnightImpletation">
<property name="pizzaStrore">
<ref local="pizzaMaker"/>
</property>
</bean>

<bean id="pizzaMaker" class="com.knight.DominoPizza">
<constructor-arg>
<value>DominoPizza</value>
</constructor-arg>
</bean>

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

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

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

</beans>
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"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="knightTarget" class="com.knight.KnightImpletation">
<property name="pizzaStrore">
<ref local="pizzaMaker"/>
</property>
</bean>

<bean id="pizzaMaker" class="com.knight.DominoPizza">
<constructor-arg>
<value>DominoPizza</value>
</constructor-arg>
</bean>

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

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

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

</beans>