File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Aspect Oriented Programming and the fly likes Spring 1.2 AOP, Advice is not executing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Aspect Oriented Programming
Bookmark "Spring 1.2 AOP, Advice is not executing" Watch "Spring 1.2 AOP, Advice is not executing" New topic

Spring 1.2 AOP, Advice is not executing

Man Sharma

Joined: Mar 23, 2009
Posts: 4
I need some help to get my AOP implementation working. I just want to execute a piece of code before invokation of a method.

Here is the code snippet.

<!-- Advice -->
<bean id="urlTamperingDetectorAdvice" class="" />
<!-- Advisor -->
<bean id="urlTamperingAdvisor" class="">
<property name="mappedNames" value="getRequestBody" />
<property name="advice" ref="urlTamperingDetectorAdvice" />
<!-- Proxy -->
<bean id="" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="" parent="">
<property name="suffix" value="/approve" />
<property name="fieldUnpackers">
<ref bean="" />
<property name="interceptorNames">

The class for Advice

public class UrlTampringDetector implements MethodInterceptor
public Object invoke(MethodInvocation methodInvocation) throws Throwable
ValidateUrl();// some logic here
return methodInvocation.proceed();

Now how I am expecting this to called

We have some handlers for different kind of activities, that later executes a list of tasks. e.g.

<bean id="myTask..processor.TaskHandler" class="com.myTask.processor.handler.impl.RequestMessageHandlerImpl">
<property name="taskProcessors">
<ref bean="myTask.FlagInComingParametersTask" />
<ref bean="myTask.SetLocaleSpecificPropertiesTask" />
<ref bean="myTask.Host_Generic_Task" />

<bean id="myTask.Host_Generic_Task" class="">
<property name="taskMap">
<entry key="hostType1">
<ref bean="" />

In, it is calling a method of the WebServiceRequesterTaskA class.

In my scenario the method of target class is being executed but my proxy's method is not being executed. I dont know what I am doing wrong.
Consider Paul's rocket mass heater.
subject: Spring 1.2 AOP, Advice is not executing
Similar Threads
spring AOP doesn't work
AOP configuration seems to be invalid
Struts2 with Spring AOP
Spring AOP Logging Interceptor not working
Needs help for AoP implementation with Spring