Announcement Announcement Module
Collapse
No announcement yet.
@Autowire @Qualifer with EL Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Autowire @Qualifer with EL

    I would like to specify the component name in an @Qualifier annotation using EL to allow a @Component to be specified in configuration.

    I can't get @Qualifier to work with EL?

    This works:
    public class HostingFacade {
    @Autowired
    HostingFacade(
    @Qualifier("localHosting") HostingGateway hosting,
    @Value("${cdn}") String hostingType) {
    ...
    }
    and hostingType is set to localHosting


    This fails:
    public class HostingFacade {
    @Autowired
    HostingFacade(
    @Qualifier("${cdn}") HostingGateway hosting,
    @Value("${cdn}") String hostingType) {
    ...
    }
    with an org.springframework.beans.factory.UnsatisfiedDepen dencyException

    (using spring 3.0.0.M4)

    Any thoughts would be appreciated.
    Mark

  • #2
    @Qualifier's value parameter not passed by EL?

    This fails:
    public class HostingFacade {
    @Autowired
    HostingFacade(
    @Qualifier("${cdn}") HostingGateway hosting) {
    ...
    }
    with an org.springframework.beans.factory.UnsatisfiedDepen dencyException

    The interesting part of the exception seems to be:

    Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [com.m4.model.impl.cdn.HostingGateway] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Qua lifier(value=${cdn})}

    It doesn't look like the @Qualifier parameter value is passed by EL.

    (running against spring-trunc 2010-10-25)

    Comment


    • #3
      This fails:
      public class HostingFacade {
      @Autowired
      HostingFacade(
      @Qualifier("${cdn}") HostingGateway hosting) {
      ...
      }
      with an org.springframework.beans.factory.UnsatisfiedDepen dencyException

      The interesting part of the exception seems to be:

      Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [com.m4.model.impl.cdn.HostingGateway] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Qua lifier(value=${cdn})}

      It doesn't look like the @Qualifier parameter value is passed by EL.

      (running against spring-trunc 2010-10-25)

      Comment

      Working...
      X