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

SpringBeanProcessor does not warn about beans ambiguity



    • Enhancement
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 3.0.16.Final
    • None
    • CDI Integration


      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:

      interface Foo {
          @GET public int foo();
      public class FooOne implements Foo {
          public int foo() {return 1;}
      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.




            Unassigned Unassigned
            alexander_radzin Alexander Radzin (Inactive)
            0 Vote for this issue
            2 Start watching this issue