|Stripes EJB3 Interceptor is superseded by Stripes Injection Enricher|
Stripes Injection Enricher satisfies injection points specified declaratively using standard Java EE annotations (@EJB, @Inject and @Resource).
Stripes already integrates with Spring to provide your ActionBean classes access to Spring resources in the form of configured Spring beans.
This extension is very similar to the Spring Interceptor, in fact it was inspired by it.
Add Stripes EJB3 Interceptor JAR file to your classpath.
Like with the Spring Interceptor you need to configure your StripesFilter. In your web.xml file locate the initialization parameters for the Stripes Filter. If you do not already have the Interceptor.Classes parameter defined, add the following:
The parameter tells Stripes to use the EJB interceptor, and also not to stop using the Before/After method interceptor (which is configured by default). That's all, we're done with configurations.
Stripes uses the EJBInterceptor to inject EJB beans into ActionBeans when instantiated. To do this, it must be told how to inject beans and what to inject. As opposed to pushing the linkage out to an XML file, a simple annotation is used. The standard case would look something like this:
This extension also supports auto-wire by name. If you omit the value of the @EJBBean annotation thusly:
Stripes will attempt to auto-wire by name. The name of the desired bean is derived from the property name or the method name - if the method name starts with 'set' then it is removed and the next character down-cased (following standard JavaBean rules), otherwise the entire method name is taken verbatim. In the example above this yields bugManager. The initial context is then queried to see if it contains a bean called bugManager.
Stripes can inject EJB beans through both method access and field access.
If the JVM's security manager will permit it, Stripes will even inject EJB beans, when requested, into protected, package access and private fields and methods. If the JVM's security manager does not permit this, an exception will be raised explaining the problem.
If you are having trouble with JNDI binding and local interfaces use the following:
It requires additional configuration of a context in the EJBInterceptor.findEJB() method.