View Full Version : Will this work? EJB and AOP...Happy end?!
dobri
Apr 15th, 2005, 08:25 AM
Hi!
I am trying to combine EJB with AOP at the very moment. I would like to advice a method of SLSB but cannot find enough information. Could you help me? The "Will this work? EJB and AOP" ()from EJB forum) is really helpful discussion but is not finished.
Please do not advice me to use Spring instead SessionBeans, I have no choice =)
Wiating for your favourable help :wink:
Rod Johnson
Apr 15th, 2005, 08:56 AM
You can't advise an EJB instance. It needs to be managed by the EJB container. However, you can run a Spring context behind an EJB facade where you have advice on Spring-managed objects.
dobri
Apr 15th, 2005, 09:33 AM
Thank you very much, man. I will follow your advice. Anyway it is better from design point of view to use SLSB as facades and to implement the real business logic in bunch of well designed helper classes. So I will advice my helper classes. Now I am interested - in order that I call SLSB from a servlet using a configuration in a springconfig.xml placed in my web project (supplied with all needed Spring libs):
<bean id="myBusinessLogic"
class="org.springframework.ejb.access.LocalStatelessSessi onProxyFactoryBean">
<property name="jndiName">
<value>java:comp/env/MySessionEJB</value>
</property>
<property name="businessInterface">
<value>my.org.MyBusinessLogic</value>
</property>
</bean>
and when I call a method over SLSB => I need another springconfig.xml defined in my EJB project (also supplied with all needed Spring libs) in order to advice the real method called within the helper class (that holds the real iimplementation used from the SLSB).:
<!--CONFIG-->
<bean id="myBusinessLogicImpl"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>my.org.MyBusinessLogic</value>
</property>
<property name="target">
<ref local="targetMyBusinessLogic"/>
</property>
<property name="interceptorNames">
<list>
<value>theTracingBeforeAdvisor</value>
</list>
</property>
</bean>
<bean id="targetMyBusinessLogic" class="my.org.MyBusinessLogicImpl" />
My question is : is that correct architecture? and if it is not correct to separate in such way the Spring containers (have two springconfigs.xml), Whichis the right way? Where I can read more abouth that?
Thank you! :wink:
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.