[jboss-jira] [JBoss JIRA] (WFLY-10029) bean-discovery-mode="annotated" is not working like described in the spec

Ralph Soika (JIRA) issues at jboss.org
Thu Mar 15 04:23:00 EDT 2018


Ralph Soika created WFLY-10029:
----------------------------------

             Summary: bean-discovery-mode="annotated" is not working like described in the spec
                 Key: WFLY-10029
                 URL: https://issues.jboss.org/browse/WFLY-10029
             Project: WildFly
          Issue Type: Bug
          Components: CDI / Weld
    Affects Versions: 10.1.0.Final
            Reporter: Ralph Soika
            Assignee: Martin Kouba
            Priority: Minor


I think we have a problem in Wildfly 10 concerning scanning of CDI Beans. Take a look at the following example: 


{code:java}
@Stateless
@LocalBean
public class SomeService {
 ...
}


public class SomeClass  {
	@EJB
	SomeService someService;
 ....
}
{code}

We have a stateless session ejb an a bean which is not annotated with a scope but is injecting the service EJB. If you use a beans.xml with the tag  


{noformat}
 bean-discovery-mode="annotated"
{noformat}


This works in wildfly 10. But this is not correct behavior as stated in the specification. It says that in this case only beans with a scope annotation should be threaded as CDI which is  not hte case for SomeClass. Normally as a developer you would not complain much about this.
I recognized this after I tried to run my application on Glassfish/Payara4 which did no longer work until I changge the beans.xml tag to:


{noformat}
 bean-discovery-mode="all"
{noformat}


Now it works in both application servers. I think in wildfly we are misinterpreting the attribute "bean-discovery-mode". I think this should be changed in the next versions for EE8. I don't know if this behavior is a known issue and maybe it is still under development.

I know that with such a change some projects (also my own ones) will break. So maybe a new configuration switch like "strict-cdi-scanning" is helpful. 





--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list