Announcement Announcement Module
No announcement yet.
newbie question concerning aspectjweaver.jar Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • newbie question concerning aspectjweaver.jar

    Hello Community,

    Iīm new to Spring-AOP and have a question concerning aspectjweaver.jar.

    first the story:

    I tried to do some performance-logging with the JamonPerformanceMonitorInterceptor which is included in spring.jar (2.5.6).

    In my aspects-configuration.xml iīve defined something like:

    		<aop:pointcut id="jamonMonitoringPointcut"
    			expression="execution(* x.y.MyClass.refresh(..))" />
    		<aop:advisor pointcut-ref="jamonMonitoringPointcut"
    			advice-ref="jamonMonitoringAspectInterceptor" />
    	<!-- Performance Monitoring Bean-->
    	<bean class="org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor"
    		<property name="loggerName" value="Profiler" />
    Everything works fine (every refresh methode is correct logged) when iīve include the aspectjweaver.jar in my classpath.
    If iīve not included aspectjweaver.jar in my classpath, i get an exception while starting my application:

    Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException
    1. I thought i only need to include aspectjweaver.jar in my classpath, if i want to enable @AspectJ support (spring documentation 6.2.2).
    What does is mean 'to enable @AspectJ support'? I havenīt used some aspectj-style annotations.

    2. Is it possible to uses the JamonPerformanceMonitorInterceptor with using some XML based pointcut expressions like defined above without to include this aspectjweaver.jar?


  • #2
    Spring uses classes in aspectjweaver.jar to parse pointcut expressions and making matching decisions. In your case, you will need to have aspectjweaver.jar in the classpath.



    • #3
      thank you ramnivas,

      you said in my case i need to have aspectjweaver.jar in the classpath,
      but if this jar is needed to parse pointcut expressions and making matching decisions,
      then itīs needed in nearly every case, when you want to use aspects (except for example creating proxys with org.springframework.aop.framework.ProxyFactoryBean and some interceptors).

      If this jar is needed in nearly every case - why isnīt it a spring module and included in the spring.jar?

      The aspectjweaver.jar is about 1.5 MByte big -> 5 times bigger than the spring-core module itself.
      I want to use only spring-aop with proxy style - no aspectj - is there a possibility to use a smaller jar?


      • #4
        It isn't a spring module jar because it is from a different project (AspectJ). If the jar file size is a concern (on most projects, it isn't), you may try using aspectjrt.jar and org.aspectj.matcher.jar from AspectJ distribution.