Using Java EE CDI it can happen that one would like to inject an
@ApplicationScoped bean into a
This situation can be problematic because
@SessionScoped beans need to be
@ApplicationScoped usually are not.
There is an interesting article which summarizes some possible strategies to avoid this issue, but you can also use an alternative (and more decoupled) approach: using CDI Events.
You usually need that injection point because you want to call a method of the
@ApplicationScoped bean. You can obtain the same result firing a CDI Event and observing it.
According to CDI specification1, Events are passivation capable, so it is safe to inject them into serializable beans.
1) CDI spec 1.2, section 6.6.3, “Passivation capable dependencies”