1 Reply Latest reply on Jan 23, 2012 11:36 AM by mbogoevici

    Spring Module

    sampi
      Hallo,
      We habe two external jar with 2 different applicationContext.xml (we need both and don't have the possibility to change them)
      I want to inject a particular Spring bean into CDI. I do it this way:

      public class SpringCdiProducer {

              @Produces
              @Web
              @SpringContext
              ApplicationContext context;
             

             
              @Produces
              @SpringBean
              Management management;

      }

      I get this error:

      No unique bean of type ..... is defined: expected single bean but found 2:....
      The bean Management is definie in both applicationContext.xml with different Implementation. (we don't have the possibility to change it)

      Question: how can i resolve this problem?
      It is possible to geht the bean by name (
      like
      @Produces
      @SpringBean(name="nameOfTheSearchbean")
      Management management;