Announcement Announcement Module
Collapse
No announcement yet.
newbie question concerning aspectjweaver.jar Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:

    Code:
    	<aop:config>
    		<aop:pointcut id="jamonMonitoringPointcut"
    			expression="execution(* x.y.MyClass.refresh(..))" />
    
    		<aop:advisor pointcut-ref="jamonMonitoringPointcut"
    			advice-ref="jamonMonitoringAspectInterceptor" />
    	</aop:config>
    
    	<!-- Performance Monitoring Bean-->
    	<bean class="org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor"
    		id="jamonMonitoringAspectInterceptor">
    
    		<property name="loggerName" value="Profiler" />
    	</bean>
    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:

    Code:
    ...
    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?

    thanks

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

    -Ramnivas

    Comment


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

      Comment


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

        -Ramnivas

        Comment

        Working...
        X