>
and if:> @Inject EntityManager em
> and this is something
> where persistence spec - or better
> persistence providers as such cannot
> do much.
The persistence spec could simply require providers to implement a CDI producer for EM, would that be a problem?
On platform level, servers could override the producer and inject an EM provided by the server.
Thr whole problem is that the Platform spec doesn’t cover these integration points well, not with spec wording and certainly not with TCK. That’s why I think it’s better to have this directly in individual specs like Persistence. We did it in JTA with @Transactional, in concurrency with the @Asynchronous interceptor, I don’t see why other specs can’t do that too.
But the main point in this thread is to move things that are nit core DI to be outside of the core CDI spec. CDI is already so much more than plain DI, with interceptors, events, etc. But it definitely shouldn’t define which resources are injected (e.g. HTTP request or EM). In my opinion, even having Request and Session scope in CDI is wrong, they should have been in Servlet spec.
Ondro