Skip to content

Commit

Permalink
Arc - tweak ContextNotActiveException for session scoped beans to men…
Browse files Browse the repository at this point in the history
…tion optional enablement
  • Loading branch information
manovotn committed Jan 6, 2025
1 parent 0a91594 commit bb7c3b1
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import jakarta.enterprise.context.ContextNotActiveException;
import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.context.SessionScoped;
import jakarta.enterprise.context.spi.Contextual;

import io.quarkus.arc.Arc;
Expand Down Expand Up @@ -66,6 +67,8 @@ private static ContextNotActiveException notActive(InjectableBean<?> bean) {
bean.getScope().getSimpleName(), bean);
if (bean.getScope().equals(RequestScoped.class)) {
msg += "\n\t- you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding";
} else if (bean.getScope().equals(SessionScoped.class)) {
msg += "\n\t- @SessionScoped is not supported by default. However, a Quarkus extension implementing session context can be used to enable this functionality (such as Undertow extension).";
}
return new ContextNotActiveException(msg);
}
Expand Down

0 comments on commit bb7c3b1

Please sign in to comment.