This content has been marked as final.
Show 2 replies
-
1. Re: Weld SPI: ResourceReference vs. ResourceReferenceFactory
mkouba Aug 2, 2018 7:02 AM (in response to ljnelson)- create the EntityManager in a ResourceReferenceFactory#createResource() implementation and return a SimpleResourceReference holding the result (IMHO this seems like the proper way to do it, but it seems no one else—at least on Github—does it this way)
Well, WildFly does - see https://github.com/wildfly/wildfly/blob/master/weld/jpa/src/main/java/org/jboss/as/weld/services/bootstrap/WeldJpaInjectionServices.java#L136-L139.
Anyway, I'm not quite sure but I think that
ResourceReference
should be a holder of a resource instance. I.e. it's better to follow what WildFly does. -
2. Re: Weld SPI: ResourceReference vs. ResourceReferenceFactory
manovotn Aug 2, 2018 7:12 AM (in response to ljnelson)I figured pretty much what Martin did, it seems li
ke
ResourceReference
is better fit for a holder.However, in the end it boils down to whatever works for you since the SPI isn't limiting you here.