In CDI prior to CDI 4.0, JAR and WAR archives which contain a beans.xml deployment descriptor file that does not specify
a version attribute on the root <beans> element are considered explicit bean archives.
In these archives, CDI can manage and inject any bean, except those annotated with @Vetoed.
In CDI 4.0, these archives are considered implicit bean archives. In implicit bean archives, CDI can only manage and inject beans annotated with a bean-defining annotation.
To mark an archive as an explicit bean archive and restore the bean discovery behavior of the previous release,
specify both the version attribute (set to 1.1 or newer) and the bean-discovery-mode="all" attribute,
on the beans element:
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
bean-discovery-mode="all"
version="4.0">
</beans>
This rule has an automated fix to add the missing version and bean-discover="all" attributes. Copy the custom configuration to your application build file to enable the fix automation.
For more Jakarta 10 migration information, see Differences between Jakarta Contexts and Dependency Injection 4.0 and 3.0.