Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2160

Cannot initialize @ViewScoped bean with bean-discovery-mode="annotated"

XMLWordPrintable

      I have a CDI bean.

      @Named("viewCDI")
      //+@javax.enterprise.context.SessionScoped
      //+@com.rico.cdi.CDIViewScoped
      //-@javax.faces.view.ViewScoped
      //-@javax.faces.bean.ViewScoped
      public class HelloViewScoped implements java.io.Serializable{
        private Date  created;  
        public HelloViewScoped(){
          created=new Date();  
        }
        public Date getCreated() {
          return created;
        }
      }
      

      In beans.xml I wrote:
      version="1.1" bean-discovery-mode="annotated">

      The problem is that is is not visible to JSF wen I use @javax.faces.view.ViewScoped

      The only path to get it visibe is to write a Stereotype annotation:

      @javax.enterprise.inject.Stereotype
      @javax.faces.view.ViewScoped
      @Target(TYPE)
      @Retention(RUNTIME)
      public @interface CDIViewScoped  {}
      

      }

              mkouba@redhat.com Martin Kouba
              vigor78 Igor Vlasov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: