We are trying to migrate part of our code from Seam 2 to javaEE6 standard. In the front end, we'll still use seam annotations but on backend we'll use only javaEE6 annotations, and won't use anymore the @Name
and @In
annotations.
Everything went ok when we injected the new backend EJBs in seam 2 components by this way:
@EJB(name="ExampleServiceBean") private ExampleService exampleServiceBean;
but ... this piece of code only works when injection takes place in EJB Seam Component.
When the Seam component is a simple POJO, when we try to inject the backend ejb with @EJB annotation, we get all the time NullPointerException
.
Seam component:
@In(name="ExampleServiceBean") private ExampleService exampleServiceBean;`
Ejb Seam component:
@Stateless @TransactionAttribute(REQUIRED) @Name("ExampleServiceBean") public class ExampleServiceBean implements ExampleService{
by
Seam component:
@EJB(name="ExampleServiceBean") private ExampleService exampleServiceBean;
Standard ejb:
@Stateless @TransactionAttribute(REQUIRED) @Name("ExampleServiceBean") public class ExampleServiceBean implements ExampleService{
we get a NullPointerException
.
I would recommend to use CDI like it is described here:
https://github.com/seam/migration/blob/develop/open18_migration.asciidoc#migrate-to-cdi
I don't quite get what you mean by
In the front end, we'll still use seam annotations