Announcement Announcement Module
Collapse
No announcement yet.
AOP for spring batch Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    You need to use AspectJ here.

    Comment


    • #3
      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, 07:01 AM.

      Comment


      • #4
        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(); }
        }

        Comment


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

          Comment


          • #6
            Hi Andrew, Denis

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

            Thanx,
            Joslin

            Comment

            Working...
            X