Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-19358

Singleton bean is discovered by cdi validator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.3.0.Alpha2
    • 4.3.0.Alpha1
    • cdi
    • None
    • Hide

      1. Create CDI 1.2 project, discovery mode annotated
      2. Add Bean

      import javax.inject.Singleton;
      
      @Singleton
      public class B1 {
      	
      
      }
      

      3. add another bean

      import javax.enterprise.context.ApplicationScoped;
      import javax.inject.Inject;
      
      @ApplicationScoped
      public class B2 {
      	
      	@Inject
      	private B1 b;
      
      }
      

      Injection point is satisfied, but it shouldn't be because B1 isnt annotated with bean defining annotation

      Show
      1. Create CDI 1.2 project, discovery mode annotated 2. Add Bean import javax.inject.Singleton; @Singleton public class B1 { } 3. add another bean import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @ApplicationScoped public class B2 { @Inject private B1 b; } Injection point is satisfied, but it shouldn't be because B1 isnt annotated with bean defining annotation

      @Singleton is pseudo-scope which means its not bean defining annotation and the bean annotated with this pseudo-scope shouldn't be considered when discovery mode is set to annotated. However CDI tooling is considering it.
      Im not sure if this applies only for CDI 1.2 or also for 1.1 ?

            scabanovich Viacheslav Kabanovich (Inactive)
            rawagner@redhat.com Rastislav Wagner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: