1 Reply Latest reply on Jan 4, 2016 6:50 AM by mkouba

    Shouldn't BeforeBeanDiscovery#addStereotype() create custom bean defining annotations?

    fabio.simeoni

      Hello,

       

      I was expecting BeforeBeanDiscovery#addStereotype() would turn a legacy annotation into a bean defining annotation (in CDI 1.2).

      For example, I thought this extension might do the trick for java.ejb.Singleton (uses delta-spike helpers):

       

      public class MyExtension implements Extension {

       

         void make_singleton_ejbs_stereotypes(@Observes BeforeBeanDiscovery event) {

        

           event.addStereotype(Singleton.class, new ApplicationScopedLiteral());

        }

      }

       

      But, alas no. If the discovery-mode="all", it does makes @Singleton(s) application-scoped.

      But If discovery-mode="annotated" it does not add @Singleton(s) to the least of candidate beans, i.e. it does not turn @Singleton into a bean defining annotation.

       

      Shouldn't it?

       

      cheers

       

      f