Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1132

SpringBeanProcessor does not warn about beans ambiguity

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Obsolete
    • Minor
    • None
    • 3.0.16.Final
    • CDI Integration

    Description

      SpringBeanProcessor does not detect and report ambiguity of beans that implement one interface when JAX-RS annotations are written on the interface.

      Here is an example. Interface Foo has 2 implementations:

      @Path("/foo")
      interface Foo {
          @GET public int foo();
      }
      
      @Service
      @Qualifier("one")
      public class FooOne implements Foo {
          public int foo() {return 1;}
      }
      
      @Service
      @Qualifier("two")
      public class FooTwo implements Foo {
          public int foo() {return 2;}
      }
      

      FooOne and FooTwo are both legal Spring beans that can successfully co-exist in one context and accessed by other beans that distinguish them using qualifier.

      However since annotation @Path is written on interface both beans are exposed by SpringBeanProcessor as REST web service. When relevant HTTP request is being processed one of these implementations are chosen semi-randomly.

      The choice actually is not done randomly but it depends on the order of beans deployment and therefore can depend on the application packaging, file system etc.

      In our particular case system stopped functioning correctly when we added absolutely orthogonal command line flag -XX:+AggressiveOpts

      I think that SpringBeanProcessor should at least warn or even better fail when such ambiguity is found.

      Attachments

        Activity

          People

            rh-ee-cdasoula Christina Dasoula
            alexander_radzin Alexander Radzin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: