Announcement Announcement Module
Collapse
No announcement yet.
Can not call interceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can not call interceptor

    I am a newbie in Spring AOP world. We are using spring 1.2.8.
    I am trying to write an interceptor but it does not get executed.

    I have a bean called as departmentDomainObject and an advice called setterAdvice. My contect file looks like this.

    Code:
    <bean id="departmentObject" class="com.sample.Department"></bean>
    
    <bean id="objectProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
           <property name="beanNames">
            	<list>
            		<value>*Object</value>
                 </list>
           </property>
           <property name="interceptorNames">
            	<list>
                	    <value>setterPointcutAdvisor</value>
                </list>
           </property>
    </bean>
    
        <!-- AOP setter advice -->
        <bean id="setterAdvice" class="com.sample.interceptor.SetterAdvice"/> 
        <bean id="setterPointcutAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
                <property name="advice"><ref bean="setterAdvice"/></property>
    	        <property name="mappedNames">
    	            <list>
    	                <value>set*</value>
    	            </list>
                </property>
        </bean> 
        <!-- End setter advice -->
    and the advice class looks

    Code:
    package com.sample.interceptor;
    
    public class SetterAdvice implements MethodInterceptor  {
    
    	public Object invoke(MethodInvocation invocation) throws Throwable {
    		//do something
    		return invocation.proceed();
    	}
    }
    But the SetterAdvice is never executed. Am I doing something wrong?

    Kalyani
Working...
X