There should be a way for the EnhancedListener to not apply itself if a ServletContext is determined to not be using CDI.
Idea #1: Check for files/components indicating CDI / weld use.
Have the EnhancedListener.onStartup() look for the existence of things that indicate weld is in use by the context before executing onStartup()
look for for the various bean.xml entries? look for the BeanManager and if it implements org.jboss.weld.*?
Idea #2: Check for a context init-parameter that enables/disables the entire weld layer
A simple namespaced key/name with a boolean value.
If undefined/unset, assume true, otherwise take the boolean as-is.
This could be used in conjunction with idea #1
|