Results 1 to 3 of 3

Thread: Activating Spring AspectJ support in Tomcat

  1. #1
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Question Activating Spring AspectJ support in Tomcat

    Hello,

    I'm not sure if my question belongs to this forum, or to Web forum, but anyway...

    In an application, deployed to Tomcat 5.5, I have some classes annotated with @Configurable and <aop:spring-configured/> tag in the context.

    There is no problem to activate load-time weaving in a Tomcat globally,
    by suppliying -javaagent:aspectjweaver.jar to JVM that Tomcat is running on.

    But is it possible to do it more specifically, to my Web-application only?
    BTW, by using TomcatInstrumentableClassLoader (from org.springframework.instrument.classloading.tomcat ). I have not found a way to configure it properly

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

    Default Would using <include> suffice?

    You may use <include> section of your aop.xml to specify type pattern matching only your web-application. For example, you could do something like
    Code:
    <weaver>
        <include within="com.myco.myapp..*"/>
    </weaver>
    This should give you the desired effect.

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

  3. #3
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    Quote Originally Posted by ramnivas
    You may use <include> section of your aop.xml to specify type pattern matching only your web-application. For example, you could do something like
    Code:
    <weaver>
        <include within="com.myco.myapp..*"/>
    </weaver>
    This should give you the desired effect.

    -Ramnivas
    Sorry, but not exactly so.
    With this setting (which BTW was already in place when I have posted my question ) AspectJ anyway take a look on each loaded class (as you can see from log) just to say that it want to skip it. And my aop.xml affect only my application, so nobody can warranty how AspectJ will treat another application on the same Tomcat (as I have no idea about their configurations). My goal is to restrict usage of instrumented classloader to my application only.

Posting Permissions

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