Results 1 to 7 of 7

Thread: Help with NameMatchMethodPointcutAdvisor

  1. #1
    Join Date
    Aug 2006
    Posts
    6

    Default Help with NameMatchMethodPointcutAdvisor

    Hi,

    I've configured an Advice, advisor, and a proxyfactorybean but when I glue it all together and start Tomcat, It doesnt't work.
    Here is my dispatcher-servlet.xml config:

    <bean id="clientesDAOHibernate" class="dao.implementations.ClientesDAOHibernate">
    <property name="sessionFactory"><ref bean="sessionFactory"/></property>
    </bean>

    <bean id="loggingAdvice" class="aspect.LoggingAdvice"/>

    <bean id="clientePointcutAdvisor" class="org.springframework.aop.support.NameMatchMe thodPointcutAdvisor">
    <property name="mappedName">
    <value>insert</value>
    </property>
    <property name="advice">
    <value>loggingAdvice</value>
    </property>
    </bean>

    <bean id="clientesDAO" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces">
    <value>dao.interfaces.ClientesDAO</value>
    </property>
    <property name="interceptorNames">
    <list>
    <value>clientePointcutAdvisor</value>
    </list>
    </property>
    <property name="target">
    <ref bean="clientesDAOHibernate"/>
    </property>
    </bean>

    I don't know what's wrong since I think I've got all I need to configure a method interceptor. Any ideas?

    Thanks.

  2. #2
    Join Date
    Aug 2006
    Posts
    6

    Default

    I had a mistake in my dispatcher-servlet.xml configuration, just when I declare the advice bean in the NameMatchMethodPointcutAdvisor declaration. Although I fixed it, it doesn't work. Any ideas?

    Thanks.

  3. #3
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    What's the name of the method you are trying to match? Unless the method name is just "insert", the name pattern will not match.

    If you have mathods with names such as "insertThis" and "insertThat", try the following mapped name:
    Code:
    <property name="mappedName">
        <value>insert*</value>
    </property>
    -Ramnivas
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

  4. #4
    Join Date
    Aug 2006
    Posts
    6

    Default

    Hi,

    I've already made all changes, but it doesn't work . The server starts ok, but when the program reaches the insert method in the pointcut, nothing happens... very frustrating.

  5. #5
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    Try the following:
    Code:
    <bean id="clientePointcutAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
    	<property name="mappedName">
    		<value>insert*</value>
    	</property>
    	<property name="advice" ref="loggingAdvice"/>
    </bean>
    If this doesn't work, can you try in a small standalone program?

    -Ramnivas
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

  6. #6
    Join Date
    Aug 2006
    Posts
    6

    Default

    No way. I post my current configuration:

    <bean id="loggingAdvice" class="aspect.LoggingAdvice"/>

    <bean id="clientePointcutAdvisor" class="org.springframework.aop.support.RegexpMetho dPointcutAdvisor">
    <property name="pattern" value="insert*"/>
    <property name="advice" ref="loggingAdvice"/>
    </bean>

    <bean id="clientesDAOProxy" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces" value="dao.interfaces.ClientesDAO"/>
    <property name="interceptorNames">
    <list>
    <value>clientePointcutAdvisor</value>
    </list>
    </property>
    <property name="targetName" ref="clientesDAOHibernate"/>
    </bean>

    It still doesn't, and now the server doesn't start... I think I give up.

  7. #7
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    What do you mean by server doesn't start? Does starting server throws an exception? You need to provide more details to track down this problem. I still suggest you try out in a standalone program to resolve this issue.

    -Ramnivas
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

Posting Permissions

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