Announcement Announcement Module
Collapse
No announcement yet.
AspectJ/Spring/OSGI: advice for some pointcuts fires, but not others Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AspectJ/Spring/OSGI: advice for some pointcuts fires, but not others

    Hello,

    I am trying to get AspectJ LTW working with my Spring 3.1.0.M2/OSGI setup. Target class implements a public interface. I have advice for 2 of the methods on the interface working
    - one method takes some params and return a collection
    - one method takes no param and return an object

    but 2 advice for 2 other methods also on the same interface implemented by the same class do not get invoked:
    - one method takes no param and return a Set
    - one method takes some params and return void

    I tried to find debug/trace info following instructions in http://www.eclipse.org/aspectj/doc/r...ide/index.html. But do not get anything useful in log/console.

    Any suggestion how to diagnose/resolve this issue?

    Following the info in Spring doc: http://static.springsource.org/sprin...tml#aop-aj-ltw, I add following to my pom.xml:

    Code:
    		<dependency>
    		 <groupId>org.springframework</groupId>
    		 <artifactId>org.springframework.aspects</artifactId>
    		 <version>3.1.0.RELEASE</version> 
    		</dependency>
    		<dependency>
    			<groupId>com.springsource.org.aspectj</groupId>
    			<artifactId>weaver</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>aop</artifactId>
    		</dependency>
    In my context.xml, I added:

    Code:
    	<!--  Allow proxys -->
        <aop:aspectj-autoproxy />    
        
        <!-- this switches on the load-time weaving -->
        <context:load-time-weaver
            weaver-class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>

    Thx
    Chuck

  • #2
    Are you sure that you're not calling the two methods from within your proxied class because it is not supported by Spring AOP. read reference docs for details

    Comment

    Working...
    X