+1

NO @Destroyed(SomeContext.class) can be observed in a bean with scope 
@SomeContext!
I even suggest we throw a ContextNotActive in the future.

You can observe the @Destroyed(ApplicationScoped.class) in an Extension.

But most of the time a @PreDestroy in your @ApplicationScoped bean would work 
much better!
Would that work for you?

LieGrue,
strub


> Am 29.05.2017 um 11:12 schrieb Romain Manni-Bucau <[email protected]>:
> 
> 2017-05-29 10:56 GMT+02:00 tonywestonuk <[email protected]>:
> 
>> Does it?
>> 
>> The events are the same...  (Both 2010426450)
>> 
> 
> yes, in case of a way you can put state in the ServletContext
> 
> 
>> 
>> HOWEVER,
>> There are 2 separate instances of Listener (ref 35419258 and 420676924),
>> even though Listener class is annotated with @ApplicationScoped
>> 
>> 
>> So, the end method, will not be able to access the instance variables
>> created in start.
>> 
>> Is this really the way it should be?  If so, I'll have to use static
>> variables.
>> 
> 
> It is as it should be since the spec requires the @Destroyed event to be
> fired after the context destruction (got clarified in 2.0 work which added
> a @BeforeDestroyed one)
> 
> However as said before you don't need to use static variables since you
> have @PreDestroy which is a natural fit
> 
> 
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://tomee-openejb.979440.
>> n4.nabble.com/CDI-Observes-ApplicationScoped-class-tp4681766p4681772.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.
>> 

Reply via email to