Is there a way to know if a state is active without catching ContextNotActiveException?

北慕城南 提交于 2019-12-03 07:57:18

Yeah, the only option we have in CDI 1.0 is to catch the ContextNotActiveException. This actually ends up being a big problem for apps scoped, where the scope implementation is not available for injection. E.g. You can't just @Inject RequestScopedContextImpl rq; and check the .isActive() method, because we don't have access to that class without knowing the implementation details.

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