Announcement Announcement Module
Collapse
No announcement yet.
Will this work? EJB and AOP...Happy end?! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Will this work? EJB and AOP...Happy end?!

    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:

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

    Comment


    • #3
      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):

      Code:
      	<bean id="myBusinessLogic" 
                class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
              <property name="jndiName">
                  <value>java&#58;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).:

      Code:
      	<!--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:

      Comment

      Working...
      X