-
1. Re: Conventions for defining Weld resources in Java EE 6?
cjalmeida Jun 14, 2010 9:00 PM (in response to ljnelson)Apparently people seems to be preferring wrapping all injectable resources into @Inject.
This allows the use of static annotations instead of strings
@Inject @MyPU EntityManager em; instead of @PersistentContext(
myPU
)And the use of more advanced features and lifecycle management - IIRC the @Transaction extension will require the use @Inject in place of @PersistenceContext
-
2. Re: Conventions for defining Weld resources in Java EE 6?
ljnelson Jun 14, 2010 10:24 PM (in response to ljnelson)Right, but where is the @Produces field that defines @MyPU declared? That's my question.
-
3. Re: Conventions for defining Weld resources in Java EE 6?
nickarls Jun 15, 2010 6:57 AM (in response to ljnelson)That's more of a philosophical question like
should brackets be on their own line?
;-)Personally, I would have them all in some ResourceProducer or so...
-
4. Re: Conventions for defining Weld resources in Java EE 6?
ljnelson Jun 16, 2010 8:16 AM (in response to ljnelson)Yes, knowingly.
Thanks; I've heard answers all over the map which means my question is answered: the community has NOT settled on a way to do this, so at this point any solution is not going to look odd to new developers on my project.
Personally I prefer the single-class solution as well; I've heard plenty of others who say that you should do one XYZProducer class per XYZ.
Thanks again.
Best,
Laird