- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在关注 DeltaSpike documentation创建绑定(bind)配置属性的可注入(inject)接口(interface)。
@Configuration(prefix = "application.")
public interface AppConfig {
@ConfigProperty(name = "name", evaluateVariables = false)
String getApplicationName();
}
我尝试通过 BeanProvider#getContextualReference
使用它并使用@Inject
。
@Inject
public Framework(final AppContext context, final BeanManager beanManager, AppConfig app) {
this.appContext = context;
this.beanManager = beanManager;
logger.info("Initialization application with name {}.", app.getApplicationName());
}
Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type AppConfig with qualifiers @Default
我还收到警告:不满足的依赖关系:没有 bean 与注入(inject)点匹配
我尝试摆弄 beans.xml
文件和 build.gradle
中的依赖项,但无济于事,而且我不确定我做错了什么与文档相比。
有人可以尝试为我指出正确的方向吗?
最佳答案
问题不在于 DeltaSpike,而在于 Weld,即该项目所依赖的 CDI 实现。
该问题是由 Gradle 分别构建 main
和 resource
引起的,因此首先需要修改资源输出以将它们放在一起。这将资源输出设置到类目录。
sourceSets {
main {
output.resourcesDir = output.classesDirs.singleFile
}
test {
output.resourcesDir = output.classesDirs.singleFile
}
}
然后,使用 Gradle 而不是 IDE 运行应用程序,为此,添加并配置 application
插件。这将创建一个名为 run
的 Gradle 任务。
plugins {
id "application"
id "java"
id "io.spring.dependency-management" version "1.0.9.RELEASE"
}
application {
mainClassName = "org.example.app.Main"
}
如果使用 DeltaSpike 注释,他们可能需要修改 beans.xml
以查找all
,而不是annotated
。
包含最小 DeltaSpike/Weld/Gradle 项目的存储库:
https://gitlab.com/SethFalco/mini-deltaspike
关于java - DeltaSpike 接口(interface)配置不可注入(inject),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61471768/
如何禁用使用 @ViewScoped 时出现的加载屏幕与 DeltaSpike? 最佳答案 好的,看起来这是有效的: @Specializes public class UkaClientWindow
我正在尝试使用 DeltaSpike 测试控制模块为我正在开发的新 Maven 应用程序创建集成测试 它正在部署在 Wildfly 9 实例上 一个简单的测试用例: @RunWith(CdiTestR
我尝试打印存储库中包含的查询的行数。这是存储库: @Repository public interface TagRepository extends EntityRepository { /
我正在使用 Global Alternatives 配置在 apache-deltaspike.properties 中定义 TransactionStrategy: globalAlternativ
我已经实现了从属性文件配置 CronExpression,但该属性文件是 apache-deltaspike.properties,它位于 .jar 文件内。我需要从自定义配置文件中获取 cron 表
在我的 Wildfly swarm 应用程序中,我想将 deltaspike 与数据模块、JPA 和 JTA 一起使用。 我已将 beans.xml 定义为使用 EnvironmentAwareTra
我想用 DeltaSpike-API 保护我的“无状态”EJb。 @Stateless @Remote(UserServiceRemote.class) public class UserServic
我非常喜欢将 Deltaspikes 数据模块与其存储库一起使用。为了提高生产力并减少错误,我还通过 JUnit 编写单元测试。在我在测试用例中使用 DBUnit 和 Plain JPA/Hibern
在 Wildfly 11 中部署 test.war 期间,我看到了一些警告: 09:45:32,714 WARN [org.jboss.weld.Validator] (MSC service th
我正在关注 DeltaSpike documentation创建绑定(bind)配置属性的可注入(inject)接口(interface)。 @Configuration(prefix = "appl
根据its doc Deltaspike Data 使用 ASM: As of DeltaSpike v1.4.0, the Data module internally leverages the
我编写了一个简单的 Web 应用程序来使用 Apache Deltaspike 0.5,但遇到了问题。该应用程序是一个简单的 JavaEE 6 应用程序,作为 JBoss EAP 6.1 上的 EAR
我正在尝试定义自定义 DeltaSpike ConfigSource。自定义配置源将具有最高优先级,并检查数据库中的配置参数。 我有一个 ConfigParameter 实体,它只有一个键和一个值。
我正在使用部署在 JBoss 7.1.1 上的 DeltaSpike 1.7.1 和 CDI 1.0 (Weld 1.1.5)。这是一个遗留项目,我无法更改我们正在使用的技术。 只有当我部署多个 WA
我正在尝试对 DeltaSpike 存储库运行一个简单的测试。但是,我无法注入(inject)实体管理器。我正在使用位于和测试源的生产者: @ApplicationScoped public clas
我正在尝试使用 DeltaSpike Data模块 Weld ,但每个类都用 @Repository 注释在我的 IDE 中显示警告,并在运行时显示异常。 我尝试遵循DeltaSpike docume
我猜这个标题是不言自明的。我有一份工作: import org.apache.deltaspike.scheduler.api.Scheduled; import org.quartz.Job; @S
我正在 WildFly 8 (Java EE 7) 上从 Seam 3 迁移到 DeltaSpike。与 Seam 的 seam-beans.xml 等效的 DeltaSpike 文件是什么?你能告诉
我是 Spring 的长期用户,现在不得不只切换到 Java EE。有很多事情并没有像预期的那样工作...... 我有一个 CXF/SOAP 服务 @WebService( ... ) @SOAPBi
我正在尝试使用 DeltaSpike 1.0 @Exclude-Annotation 排除 Bean 实现。排除应该基于这样的属性值: @Exclude(onExpression = "provide
我是一名优秀的程序员,十分优秀!