Announcement Announcement Module
Collapse
No announcement yet.
@Configurable and CTW problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Configurable and CTW problem

    Hi all!

    This is my first post here! I am trying really hard to make a type not controlled by the Spring container to be injected with aspects with no success.

    Iīve searched the forum and tried some things posted here but it just doesnīt work.

    Letīs get to the problem!

    I have an abstract class called AbstractViewHelper and I need to advice it after returning the invocation of a method called
    Code:
    String outcome()
    Iīve annotated the class with
    Code:
    @Configurable
    and use the following on my applicationContext-aop.xml

    Code:
    <aop:after-returning method="logMethodExit" returning="s" pointcut="execution(* edu.test..*ViewHelper.outcome(..))" />
    I also included
    Code:
    <aop:spring-configured>
    on the applicationContext-aop.xml

    The versions of libs I am using are:

    * spring-framework 2.0.8
    * spring-aspects 2.0.8
    * aspectjrt 1.5.3
    * aspectjweaver 1.5.3

    Sorry for any grammar mistakes!

    Thanks in advance!

  • #2
    This is my first post here! I am trying really hard to make a type not controlled by the Spring container to be injected with aspects with no success.
    You cannot. I suggest a read of the reference guide especially the aop chapter. Spring needs to create a proxy, when you are in control of the construction of objects that isn't possible. You will need either loadtime weaving controller by AspectJ and not spring! or compile time weaving to make it happen.

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      You cannot. I suggest a read of the reference guide especially the aop chapter. Spring needs to create a proxy, when you are in control of the construction of objects that isn't possible. You will need either loadtime weaving controller by AspectJ and not spring! or compile time weaving to make it happen.
      Martin, first of all Iīd like to thank you for the quick answer!

      Thatīs exactly what I am trying to achieve. Iīve read the aop chapter and some posts about CTW and LTW but I canīt make it work on my project.

      First I got an error ClassNotFoundException: AnnotationBeanConfigurer then I put spring-aspects on my pom.xml.

      After that Iīve tried to put agent VM argument and got "Failed to load Premain-Class manifest attribute"

      I am really confused about what to try next...

      I am guessing itīs something with the version of the libs I am using... but I really donīt know...

      Tks!

      Comment

      Working...
      X