使用泽西2.1与CDI [英] Using Jersey 2.1 with CDI

查看:173
本文介绍了使用泽西2.1与CDI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 Java EE 7中使用 Jersey 2.1 CDI code> Glassfish 4.0。



泽西模块依赖于 Guava图书馆。但是,使用带有CDI结果的Guava库(14.0.1)会引发以下异常。

  CDI部署失败:WELD-001408注入点处带有限定符[@Default]的[Set< Service>]类型的不满足依赖项[[BackedAnnotatedParameter] [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set< Service>)]的参数1。 

如何解决这个问题?

解决方案

CDI有一些可疑的行为。我们认为我们有两种解决方法:您可以自己做的一个一个在我们发布时会自动运行的程序番石榴15.0 。您可以在此阅读有关此问题的更多信息

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆