persistence
persistence copied to clipboard
Support @PersistenceContext injection in CDI SE and CDI/Servlet environment
Like Spring, add CDI decorations to provide injection for EntityManager and EntityMangerFactory for CDI SE and Servlet/CDI environment.
- CDI SE, the application is bootstrapped by a CDI container, even the embedded tomcat/jetty can be declared as CDI beans.
- Servlet/CDI, the application is war deployed into a standard servlet container that enabled CDI support via a servlet Listener.
I think there are some approaches already support this, such as Apache DeltaSpike and Quarkus, Helidon etc.
I'd go one step further and not just add some "decorations", but make the CDI way the primary way and deprecate the existing annotations. See https://github.com/eclipse-ee4j/jpa-api/issues/377
See https://github.com/jakartaee/persistence/issues/377
Yeah, I think this and #377 are essentially the same issue. Or at least the solution would be the same.