Results 1 to 3 of 3

Thread: AOP Logging on Ejb class

  1. #1

    Question AOP Logging on Ejb class

    Hi Folks,

    I am able to get AOP working for my business layer but I need to get it working for my Ejbs. I have an ejb that implments a business interface , and the ejb delegates work off to the business layer. What I need is logging on the actual ejb bean? Because ejbs dont have a bean id how do I get them logged.? Ie. I want to see in my logging ejbcreate ejbremove plus my business methods etc..

    Example
    <bean id="proxyCreator"
    class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
    <property name="beanNames">
    <list>
    <value>*ManagerImpl</value> <!-- How do I reference a EJB -->
    </list>
    </property>
    <property name="interceptorNames">
    <list>
    <value>loggingInterceptor</value>
    </list>
    </property>
    </bean>


    Any ideas?

    Thanks
    Danny

  2. #2
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    Since Spring AOP only works on services that it manages, you would need to resort to AspectJ or similar lower level AOP to add logging like that.
    Bill

  3. #3
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    I think you could do it....you would end up proxying the proxy created by the proxyfactorybean

    Code:
    <bean id="yourManagerImpl" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
       .....
    </bean>
    
    <bean id="proxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
      <property name="beanNames">
        <list>
          <value>*ManagerImpl</value> <!-- How do I reference a EJB -->
        </list>
      </property>
      <property name="interceptorNames">
        <list>
          <value>loggingInterceptor</value>
        </list>
      </property>
    </bean>
    Colin Yates
    SpringSource - http://www.springsource.com - Spring Training, Consulting, and Support - "From the Source"
    Please read http://www.springframework.org/documentation
    Co-Author of Expert Spring MVC + Web Flow.

Posting Permissions

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