gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 23:58:28 29 4
gpt4 key购买 nike

在我的 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com