- Read SpringFratamework's reference here: http://static.springframework.org/spring/docs/2.5.x/reference/ejb.html#ejb-implementation-ejb3
- Place to ejb module's classpath a file
beanRefContext.xml
:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="myBeanFactory" class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg value="myApplicationContext.xml"/>
</bean>
</beans> - Create application context file named
myApplicationContext.xml
and define You beans there. Place this file to the ejb module's classpath. - Annotate your Stateless Session Bean:
@Stateless
@Interceptors(org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.class)
public class MyFacadeBean implements MyFacade {
@Autowired
private MySpringComponent component;
...
public void foo() {
component.foo();//invocation
}
} - Deploy and test Your application.
29/01/2009
How to Use Spring from EJB3
This is a short instruction how to inject a spring-managed bean into EJB3 component.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment