Christian Bauer commented on Bug WELD-1517

This bug also affects disposer methods for application-scoped beans, they aren't called on servlet context shutdown.

There might be a separate issue here that affects not only weld-servlet: Disposer methods for application scoped beans are called after the @Destroyed(ApplicationScoped) event. So the startup/shutdown order is:

@Observes @Initialized(ApplicationScoped)
@Produces @ApplicationScoped // Where necessary
...
@Observes @Destroyed(ApplicationScoped)
@Disposes @ApplicationScoped // Where necessary

This makes it very difficult to have properly scoped startup/shutdown beans interact with each other. A much better order would be:

@Observes @Initialized(ApplicationScoped)
@Produces @ApplicationScoped // Where necessary
...
@Disposes @ApplicationScoped // Where necessary
@Observes @Destroyed(ApplicationScoped)

AFAIK the spec is silent on the order of @Disposes vs. @Destroyed events. The naming of @Destroyed implies that it happens /after/ the context was destroyed, the spec says "fired when the application is destroyed."

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
weld-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/weld-issues

Reply via email to