...
Info | ||
---|---|---|
| ||
Stripes Injection Enricher satisfies injection points specified declaratively using standard Java EE annotations ( |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<dependency> <dependency> <groupId>com.samaxes.stripes.ejb3</groupId> <artifactId>stripejb3</artifactId> <version>1.0.3</version> </dependency> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<init-param> <param-name>Interceptor.Classes</param-name> <param-value>com.samaxes.stripes.ejb3.EJBInterceptor</param-value> </init-param> <!-- or --> <init-param> <param-name>Extension.Packages</param-name> <param-value>com.samaxes.stripes.ejb3</param-value> </init-param> |
Code Block | ||||
---|---|---|---|---|
| ||||
<init-param> <param-name>Interceptor.Classes</param-name> <param-value> com.samaxes.stripes.ejb3.EJBInterceptor, net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor </param-value> </init-param> |
...
Code Block | ||
---|---|---|
| ||
// Inject any properties that are annotated @EJBBean("bugManager") private BugManager bugManager; // Inject any methods that are annotated @EJBBean("bugManager") public void setBugManager(BugManager bugManager) { this.bugManager = bugManager; } |
...
Code Block | ||
---|---|---|
| ||
// Inject any properties that are annotated @EJBBean private BugManager bugManager; // Inject any methods that are annotated @EJBBean public void setBugManager(BugManager bugManager) { this.bugManager = bugManager; } |
...
Code Block | ||
---|---|---|
| ||
// your interface
public interface BugManager {
}
// your implementation
@Stateless
@Local(BugManager.class)
@LocalBinding(jndiBinding = "bugManager")
public class BugManagerBean implements BugManager {
}
|
...
Code Block | ||
---|---|---|
| ||
// your bean implementation @Stateless(name = "bugManager", mappedName = "bugManager") public class BugManager implements com.Manager { } // your action bean @EJB(name = "bugManager", beanInterface = "com.Manager") public class BugActionBean { @EJBBean("java:comp/env/bugManager") private BugManager bugManager; } |
...
Code Block | ||
---|---|---|
| ||
protected static Object findEJB(String name) { // Try to lookup using the name provided try { if (ctx == null) { Properties p = new Properties(); p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.openejb.client.LocalInitialContextFactory"); ctx = new InitialContext(p); } Object ejb = ctx.lookup(name); log.debug("Found EJB bean with name [", name, "]"); return ejb; } catch (NamingException e) { throw new StripesRuntimeException("Unable to find EJBBean with name [" + name + "] in the initial context."); } } |
Code Block | ||
---|---|---|
| ||
@EJBBean("BugManagerLocal")
private BugManagerLocal bugManager;
|