Inspectopedia Help

Bean with non-default scope declares public fields

Reports managed beans with public instance fields that are not in the default @Dependent scope. According to the CDI specification, contextual scopes (@RequestScoped, @ApplicationScoped, @SessionScoped, and ConversationScoped) are not allowed for managed beans with public instance fields.


@ApplicationScoped // Warning: Bean with non-default scope must not have public fields class Car { public String engine; }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Jakarta EE: Contexts and Dependency Injection (CDI), 233.SNAPSHOT

Last modified: 13 July 2023