title: CDI. Using @Specializes
body: <p>I have a question about using <code>@Specialization</code>. As prescribed by the Java EE 6 or 7 tutorials if I declare my bean by giving it <code>@Specializes</code> annotation that it ' ll completely replace bean, which extends my bean. E.g.</p>
  <pre><code>    public interface I {}
      @Default @Q
      public class A implements I {}
      @Specializes
      public class SpecA extends A {}
      ////
      a) @Inject I a;
      b) @Inject @Q I b;
  </code></pre>
  <p>Is it enough for that SpecA will be injected to fields 'a' and 'b'?
  I tried to run this example on glassfish 4.0 and it didn't worked.</p>
  <p>I have read strange sentences in tutorials:
  'Usually, a bean marked with the <code>@Specializes</code> annotation is also an alternative and is declared as an alternative in the <code>beans.xml</code> file. '
  I don't understand what should I do to do make it work as prescribed in tutorials? Do I need add annotation <code>@Alternative</code> and add this class to <code>beans.xml</code>? Or Do I need add my bean to <code>beans.xml</code>?</p>