On 3/18/26 14:03, 'William Burke' via Quarkus Development mailing list
wrote:
>
>
> On Wed, Mar 18, 2026 at 3:05 AM 'Martin Kouba' via Quarkus Development
> mailing list <
quark...@googlegroups.com <mailto:
quarkus-
>
d...@googlegroups.com>> wrote:
>
> On 3/17/26 21:58, 'William Burke' via Quarkus Development mailing list
> wrote:
> > Alternatively, a way to associate an interceptor an
> InterceptorBinding
> >
> > I'm defining a custom scope annotation @InvocationScoped that I
> want to
> > also trigger adding an interceptor to the bean class, but I want
> this
> > interceptor to be a @Singleton.
>
> An interceptor is always @Dependent, i.e. "The lifecycle of an
> interceptor instance is the same as that of the target instance with
> which it is associated.". In other words, you can't make it @Singleton.
>
>
> Gemini lies!! Told me it was @Dependent by default.
Oh yes, these things sometimes lie you know ;-)
I tried Claude Heiku 4.5 and it got it almost right, except that it
claimed that it's a hard requirement in the spec.
In fact, the spec states:
"If an interceptor has any scope other than @Dependent, non-portable
behavior results." And non-portable behavior is bad, m'kay. And it won't
work in ArC.
>
> How does @ActivateRequestContext work then if it is dependent? Or can
> you only use that annotation on larger scoped beans like session and
> applicationscoped?
ActivateRequestContext is just a regular interceptor binding. If you
annotate a bean class, then the interceptor is used for all business
methods.
>
> @RequestScoped
> @ActivateRequestContext
> public class MyBean {
> }
Good question. I think that this should not work, because the
interceptor is associated with the MyBean contextual instance, and so
you need to lookup the contextual instance first.
In other words, you can do that but the ActivateRequestContext
interceptor will not help if the request context is not active when a
MyBean method is invoked.
> CAL%3DE%3DjRQLz4CYZ1GzPOLDREWNtQ4RCgM8QFQO6uDs3L2V95qrw%
40mail.gmail.com
> <
https://groups.google.com/d/msgid/quarkus-dev/
> CAL%3DE%3DjRQLz4CYZ1GzPOLDREWNtQ4RCgM8QFQO6uDs3L2V95qrw%
40mail.gmail.com?utm_medium=email&utm_source=footer>.