Announcement Announcement Module
Collapse
No announcement yet.
Help with NameMatchMethodPointcutAdvisor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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

      Comment


      • #4
        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.

        Comment


        • #5
          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

          Comment


          • #6
            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.

            Comment


            • #7
              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

              Comment

              Working...
              X