本文介绍了使用泽西2.1与CDI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在 Java EE 7中使用
Jersey 2.1
和 CDI
code> Glassfish 4.0。
泽西模块依赖于。但是,使用带有CDI结果的Guava库(14.0.1)会引发以下异常。
CDI部署失败:WELD-001408注入点处带有限定符[@Default]的[Set< Service>]类型的不满足依赖项[[BackedAnnotatedParameter] [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set< Service>)]的参数1。
如何解决这个问题?
解决方案
CDI有一些可疑的行为。我们认为我们有两种解决方法:和。您可以。
I try to use Jersey 2.1
and CDI
in my Java EE 7
project which is deployed on Glassfish 4.0.
Jersey modules depend on Guava libraries. But using Guava libraries (14.0.1) with CDI results the following exception being thrown.
CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)].
How can I overcome this issue?
解决方案
CDI has some questionable behavior. We think we have two workarounds: one that you can do yourself and one that will work automatically when we release Guava 15.0. You can read more about the problem here.
这篇关于使用泽西2.1与CDI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!