I agree. I think that the CDI spec could be the best place for that
annotation though (so e.g the JSF and JMS spec don't end up adding the same
annotation for similar functionality)
I see
https://issues.jboss.org/browse/CDI-473
which was requesting this for @ApplicationScoped only so there are some CDI
only uses for it.
Kind regards
Evans Armitage
On Mon, Aug 24, 2015 at 6:37 PM, Nigel Deakin <nigel.deakin_at_oracle.com>
wrote:
> On 24/08/2015 16:29, Evans Armitage wrote:
>
>> Hi Nigel,
>>
>>
>> For ".. if the injected bean is a JMS listener, and the listener has
>> "normal" scope. then the developer needs to be
>> aware that they need to call a method to force it to start listening. "
>>
>> Would it not be cleaner to have an @Eager annotation similar to
>>
>>
>> https://github.com/omnifaces/omnifaces/blob/2.1/src/main/java/org/omnifaces/cdi/eager/EagerExtension.java
>>
>>
> Hmm. Yes it would.
>
> In fact I wonder whether we should try and make this the default behaviour
> for any normal-scoped bean which is annotated with @JMSListener (assuming
> that this is possible to implement in a portable extension). Creating an
> instance lazily when a business method is invoked doesn't really make sense
> when the bean is a listener.
>
> Nigel
>