CDI - Observing Container Events

六眼飞鱼酱① 提交于 2019-12-04 05:57:09

Thanks to Pete Muir, the solution was to implement the Extension interface. Once I did that, along with creating a special file, it worked perfectly.

The thing to remember is, if you want to observe (or act on) container events, you must implement the extension interface as it is a special event.

https://docs.jboss.org/weld/reference/latest/en-US/html/extend.html#d0e4984

Walter

George Armhold

The "special file" mentioned by Walter White is:

META-INF/services/javax.enterprise.inject.spi.Extension

That file should contain the fully-qualified name of your Extension class. ie:

org.mydomain.extension.MyExtension
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!