jakarta-ee - IDEA错误 "Managed bean must be a concrete class, or is annotated with @Decorator"

标签 jakarta-ee intellij-idea abstract-class cdi

在我的 Java EE 项目中,我有一些抽象类。 IntelliJ IDEA 用红色下划线并告诉我:

Managed bean must be a concrete class, or is annotated with @Decorator

A top-level Java class is a managed bean if it is defined to be a managed bean by any other Java EE specification, or if it meets all of the following conditions:

  • It is not a non-static inner class.
  • It is a concrete class, or is annotated @Decorator.
  • It is not annotated with an EJB component-defining annotation or declared as an EJB bean class in ejb-jar.xml.
  • It has an appropriate constructor—either:
    • the class has a constructor with no parameters, or
    • the class declares a constructor annotated @Inject.


我只想使用抽象类,没有任何注释。尽管 IntelliJ 告诉我这是一个错误,但我的 JBoss 服务器并没有提示它。

有什么解释吗?

最佳答案

我的猜测是,这是设置 > 编辑器 > 检查 > CDI(上下文和依赖注入(inject))中的托管 Bean 不一致错误检查。其严重性为错误,因此将用红色波浪线下划线。

看来您并不真正关心此检查,因此只需取消选择它并保存您的更改。

关于jakarta-ee - IDEA错误 "Managed bean must be a concrete class, or is annotated with @Decorator",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35150640/

相关文章:

java - IntelliJ - 为什么终端有不同的环境变量值

ruby - 调试器 (Intellij IDEA) 在遇到断点时失败 (cucumber, ruby​​, rspec, capybara)

java - 测试抽象类中的方法一次,而不是每次实现

c# - 在这种情况下我应该使用接口(interface)还是抽象类?

Ubuntu 15.10 : port 8080 already used

java - 使用通用接口(interface)时不调用 EJB 拦截器

java - 如何从位置读取文本文件

java - 智能 : Tests not started

php - 抽象静态属性不能被覆盖?

java - 使用 JWT 的基于角色的 Rest-API