Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-719

@Named qualifier is not adhering to CDI spec default naming conventions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.3, 1.1.6
    • 1.1.7
    • Core
    • None

    Description

      Using the following test case and producer methods, OWB cannot resolve this bean until the third producer method. All three work correctly in Weld. As noted from original poster:

      See CDI Spec 1.0, section 3.3.8:

      "The default name for a producer method is the method name, unless the
      method follows the JavaBeans property getter naming convention, in
      which case the default name is the JavaBeans property name."

      @RunWith(Arquillian.class)
      public class FooTest {
      @Deployment
      public static Archive<?> createTestArchive()

      { return ShrinkWrap.create(JavaArchive.class).addClass(FooMaker.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); }

      @Inject @Named("foo")
      private String foo;

      @Test
      public void testFoo()

      { Assert.assertEquals("bobo", foo); }

      }

      I tried the following producers, only the last worked (OWB not using method name or JavaBeans naming conventions)

      @Produces @Named
      public String getFoo()

      { return "bobo"; }

      @Produces @Named
      public String foo() { return "bobo"; }

      @Produces @Named("foo")
      public String foo()

      { return "bobo"; }

      Attachments

        Activity

          People

            arne Arne Limburg
            johndament John D. Ament
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: