Results 1 to 6 of 6

Thread: AOP for spring batch

  1. #1
    Join Date
    Jun 2009
    Posts
    4

    Default AOP for spring batch

    I wanted to do logging for Spring batch application.

    I want to log the reader,writer as well as service layer.

    i tried to use dynamic proxies bt the prob is only my service layer has interface-implementation structure bt the reader and writers extend DelegatingItemReader and DelegatingItemWriter so i cant use dynamic proxies . If i use CGLIB poxied it wont work for the service layer.
    I want a common logger.

    Please Help

    Thanx in advance,
    gemi

  2. #2
    Join Date
    Aug 2008
    Location
    Vancouver, BC
    Posts
    768

    Default

    You need to use AspectJ here.

  3. #3
    Join Date
    Jun 2009
    Posts
    4

    Default

    Hi Andrew,

    Thank u for ur reply,

    How can we declare multiple pointcuts for a single aspect?
    So far whatever examples i have encountered on AspectJ, have single pointcuts.

    Regards,
    Joslin
    Last edited by gemi; Nov 11th, 2009 at 06:01 AM.

  4. #4
    Join Date
    Aug 2008
    Location
    Vancouver, BC
    Posts
    768

    Default

    You can declare multiple pointcuts just like you declare any other kind of declaration:

    aspect Foo {
    pointcut a : execution(* *(..));
    pointcut a : within(*..MyClass);
    before() : a() && b() { doSomething(); }
    }

  5. #5
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    Quote Originally Posted by gemi View Post
    Hi Andrew,

    Thank u for ur reply,

    How can we declare multiple pointcuts for a single aspect?
    So far whatever examples i have encountered on AspectJ, have single pointcuts.

    Regards,
    Joslin
    There is nothing more than having two methods marked by @Pointcut as aaspect class. AspectJ documentation has couple of examples.

  6. #6
    Join Date
    Jun 2009
    Posts
    4

    Default

    Hi Andrew, Denis

    Thank you for your reply.
    I used PerformanceMonitorInterceptor, it logged for reader, writer and service layer methods as well.

    Thanx,
    Joslin

Posting Permissions

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