[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jakarta.ee-spec.committee] Fwd: [ejb-dev] [External] : Re: [jakarta.ee-spec] Interceptors seems like a template spec
|
Re-sending as I didn't notice I'd only replied to ejb-dev.
-- Ed
-------- Forwarded Message --------
As David writes, Interceptors is used by more than just CDI and I
can't really say that flipping everything around to depend on CDI
is necessarily a good thing. I think he is illustrating how
extracting Interceptors out as a standalone Spec could be a fair
amount of work (Interceptors assertions, separated from EJB and
possibly elsewhere) -- probably this is why it isn't already
extracted separately. That said, I'm sure it's not impossible and
... perhaps if someone were to take some time with this it could
be done.
What do people think about trying to extract the core of
Interceptors? I'm a fan of the mantra: where the requirements are
defined, the TCKs should follow. So, if CDI has interceptor tests,
I would hope those were determined to be assertable
features/requirements of the CDI Spec., hence they are in the CDI
TCK. If they are, in fact duplicating Interceptor tests -- we
might solve that with an extracted Interceptors TCK.
-- Ed
On 8/25/2021 1:41 PM, David Blevins wrote:
I missed one. Interceptors of an EJB can
have injected and lookup all the same things that the EJB can
have injected and look up. For example an Interceptor for an MDB
can have `@Resource private MessageDrivenContext mdbContext;`
injection and an interceptor of an EJB Session bean can have
`@Resource private SessionContext sessionContext;` injection.
Additionally, EJBs have their own private java:comp/env/
namepsace which is completely isolated to it and not seen by
other EJBs. Lets imagine we have a ColorInterceptor that looks
up `java:comp/env/favorite/color` and expects a string. Because
each EJB has its own namespace when ColorInterceptor intercepts
a method call to BeanA it may get "Blue" as a result. When
ColorInterceptor intercepts a call to BeanB it may get "Red" as
a result.
There are tests to ensure that the interceptor of an EJB is
seeing the same environment that exact EJB would see, both for
dependency injection and lookup.
_______________________________________________
ejb-dev mailing list
ejb-dev@xxxxxxxxxxx
To unsubscribe from this list, visit
https://urldefense.com/v3/__https://www.eclipse.org/mailman/listinfo/ejb-dev__;!!ACWV5N9M2RV99hQ!cpHzs1J6ctsSRFN5VRwqLWM0E8qxDVLLWDm7KN8Cb1eIzlokRYO2AFPoid-tTKk$