Results 1 to 4 of 4

Thread: Combine execution() and bean()

  1. #1
    Join Date
    Jan 2009
    Posts
    5

    Default Combine execution() and bean()

    Hi,

    Am trying to combine execution and bean in a pointcut.
    With the code below, the aspect is fine with Endpoints but not getting called for the Dao's.

    Code:
    <aop:pointcut id="samplePointCut" expression="execution(* com.xxx.yyy..*Endpoint.handle*(..)) or bean(*Dao)" />
    Is it valid to combine execution & bean ?

    Thanks,
    Aravind

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

    Default

    This is valid and should have worked. Please show more details to check if you are hitting a bug.

    Also, which version of Spring and AspectJ you are using?

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

  3. #3
    Join Date
    Jan 2009
    Posts
    5

    Default

    Am using aspectjweaver-1.6.3 & Spring -2.5.6.

    Code:
    <!-- Aop Config -->
    <bean id="performanceAspectBean" class="com.xxx.yyy.aspect.PerformanceAspect" />
    
    <aop:config>
    	<aop:pointcut id="samplePointCut" expression="execution(* com.xxx.yyy..*Endpoint.handle*(..)) or bean(*Dao)" />
    	
    	<aop:aspect id="performanceAspect" ref="performanceAspectBean" order="11">
    		<aop:around pointcut-ref="samplePointCut" method="logExecutionTime" />
    	</aop:aspect>
    </aop:config>
    
    
    
    
    <bean id="sampleFunction" class="com.xxx.yyy.function.SampleFunctionImpl">
    		<property name="sampleDao" ref="sampleDao" />
    </bean>		
    
    
    <bean id="sampleDao" class="com.xxx.yyy.dao.SampleDaoImpl">
    ....
    ....
    </bean>

    For every Endpoint & Dao call, am expecting 'performanceAspectBean' to be invoked.

    Right now the behavior is fine for the endpoint; but for sampleDao, the performanceAspectBean is not getting invoked.

  4. #4
    Join Date
    Nov 2007
    Posts
    420

    Default

    I have seen the same behaviour where if you try to combine bean() and execution in the XML configuration it does not work but if you move it to use annotation it does. You can try annotation-based configuration and see if that works for you as well.

Posting Permissions

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