I have noticed that all *InjectionServices javadoc say that those
implementations should do the required injection point validations. for
example JpaInjectionServices
"Register a persistence context injection point. The implementation
validates the injection point ..."
But for some reason if a JpaInjectionServices implementation is
registered, an internal validation is triggered
"WELD-001517: The type of the resource producer field
[[BackedAnnotatedField] @PersistenceContext private
com.example.TestBean.session] does not match the resource type interface
javax.persistence.EntityManager" See [1]
This field class is an Hibernate session, Wildfly support injecting that
using @PersistentContext [2], but this validations is blocking me to do
the same in a mock test environment I am coding. I am not sure how
Wildfly inject it with Weld or if they skip Weld injecting JPA instances
because of this. Why this validation is harcoded on Weld, when for
example EjbInjectionServices doesn't force any predefined validation?
Shouldn't it be removed and leave that validation to the
JpaInjectionServices implementation as the javadoc say it is its
responsibility?.
[1]
https://github.com/weld/core/blob/master/impl/src/main/java/org/jboss/wel...
[2]
https://docs.jboss.org/author/display/WFLY8/JPA+Reference+Guide#JPARefere...