首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tomee+Microprofile UnsatisfiedResolutionException

Tomee+Microprofile UnsatisfiedResolutionException
EN

Stack Overflow用户
提问于 2020-03-30 14:38:42
回答 1查看 625关注 0票数 2

各位!

你能给我关于这个问题的建议吗?

我有一个简单的测试项目,以便使用Microprofile配置进行测试。

我测试的测试类的字段:

代码语言:javascript
复制
   @Inject
   @ConfigProperty(name = "injected.value")
   private String injectedValue;

这是我的pom的依赖项部分:

代码语言:javascript
复制
<dependencies>
        <!-- https://mvnrepository.com/artifact/org.eclipse.microprofile/microprofile -->
        <dependency>
            <groupId>org.eclipse.microprofile</groupId>
            <artifactId>microprofile</artifactId>
            <version>3.3</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
</dependencies>

我建立了战争然后:

  1. 当我将war部署到Tomee8.0.1-microprofile( tomee plugin,tomeeClassifier设置为微配置文件) ->中时,一切正常。
  2. ,但是当我将war部署到Tomee8.0.1-plus( tomee plugin,tomeeClassifier设置为+) ->时,我得到了例外:

G 211

代码语言:javascript
复制
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [java.lang.String] is not found with the qualifiers 
Qualifiers: [@org.eclipse.microprofile.config.inject.ConfigProperty(name=injected.value, defaultValue=org.eclipse.microprofile.config.configproperty.unconfigureddvalue)]
for injection into Field Injection Point, field name :  injectedValue, Bean Owner : ...

在案例1(部署到tomee 8.0.1-microprofile)中,当我将pom依赖项更改为:

代码语言:javascript
复制
<dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.eclipse.microprofile.config</groupId>
            <artifactId>microprofile-config-api</artifactId>
            <version>1.4</version>
        </dependency>
</dependencies>

我发现了一个错误:

代码语言:javascript
复制
 org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [java.lang.String] is not found with the qualifiers 
Qualifiers: [@org.eclipse.microprofile.config.inject.ConfigProperty(name=injected.value, defaultValue=org.eclipse.microprofile.config.configproperty.unconfigureddvalue)]...

有人能帮我解决这个问题吗?

我需要在prod中使用Microptofile,现在,我不能这样做。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-20 02:37:47

要使加号和羽流版本工作,必须在system.properties中包含以下属性

tomee.mp.scan = all

参考资料:http://tomee-openejb.979440.n4.nabble.com/MicroProfile-Integration-in-Plus-and-Plume-td4686818i60.html

另一种方法是使用tomee插件并在pom.xml中添加此属性:

代码语言:javascript
复制
<systemVariables>
       <tomee.mp.scan>all</tomee.mp.scan>
 </systemVariables>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60932960

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档