[weld-dev] spec question on 3.5 Resource Beans

Gavin King gavin.king at gmail.com
Wed Feb 17 14:55:40 EST 2010


On Mon, Feb 15, 2010 at 6:01 PM, Mark Struberg <struberg at yahoo.de> wrote:

> In case of injecting @PersistenceContext, adding @Produces and a Qualifier imho simply makes them a
> producer field, so I don't understand why there is any need for a special 'resource bean' in this case.

Because this behavior must be welldefined. You think you can just
combine two annotations from different specs on a single field and
"hope" for the behavior you like? Really? You really expect that
something like that is going to work in WebSphere?

> I also do not understand the restriction for disallowing @Named. Of course @Named in the EL sense
> doesn't make much sense for _any_ @Dependent scoped bean, but @Named is a perfectly valid
> qualifier also! So it would be perfectly valid to write
> private @Inject @Named("specialEm") EntityManager em;

Accessing a resource using EL is a really bad idea.

So is using @Named as a qualifier.



> It would also be perfectly possible to provide a EntityManager via a producer method btw, isn't?

Of course.

> Is there any reason why we cannot simply say that injecting EE resources must be provided
> in an EE container? Then all your neat tricks should simply just work?

"simply just work"? What, if we *pray* hard enough?

Are you out of your mind?

Have you noticed that there is a rather large blue vendor with many
strange ideas that is also expected to implement this stuff?

-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org


More information about the weld-dev mailing list