Announcement Announcement Module
Collapse
No announcement yet.
An approach for "call" Aspectj method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • An approach for "call" Aspectj method

    Hello for all,

    Reading the Spring Documentation i can see that it framework dont support the "call"īs AspectJ PointCut.

    I need take something like it:

    PHP Code:
    @AfterReturning(pointcut "call(* dataaccess.model.TicketDataAccess.runGenerator(..))"returning "ticket")
        public 
    void getGeneratedTicket(String ticket) {
            
    this.ticket ticket;
        }

        @
    SuppressWarnings("unchecked")
        @
    AfterReturning(pointcut="call(dataaccess.model.DataAccessInBean+.new())",returning="plbean")
        public 
    void setGeneratedTicket(DataAccessInBean plbean) {
            
    plbean.setTicket(this.ticket);
        } 
    But if i run it into the Spring Context, i received a "Illegal..Exception" just because spring dont support "call".

    Then i ask you: how to intercept a method call and how to intercept a bean initialization using Spring Framework AOP module ?

    Thanks!

  • #2
    Then i ask you: how to intercept a method call and how to intercept a bean initialization using Spring Framework AOP module ?
    You cannot as stated in the reference guide. Spring AOP uses a proxy based approach (check chapter 6.6.1 (Spring 2) or 7.6.1 (spring 3) of the reference guide) and that is the reason why only the execution pointcut is supported.

    If you want more don't use spring aop but use the full blown aspectJ solution with loadtime or compile time weaving.

    Comment

    Working...
    X