Results 1 to 3 of 3

Thread: @Qualifier not working after 2.5 -> 3.0.3 upgrade

  1. #1
    Join Date
    Jan 2007
    Posts
    7

    Default @Qualifier not working after 2.5 -> 3.0.3 upgrade

    Hi,

    Is there anything special I need to do in the config, to make springs @Qualifier work with 3.0.3? I had this perfectly working with 2.5, but after an upgrade, it does not. No code changes except upgrade of jars were done.

    I have a marker interface:

    Code:
    @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE})
    @Retention(RetentionPolicy.RUNTIME)
    @Qualifier
    @Inherited
    public @interface Autotaks {
    }
    which is @Qualifier annotated. I then have bean:


    Code:
    @Service
    @Autotaks
    @Transactional
    public class AutotaksTimeprisCollectorServiceImpl extends implements TimeprisCollectorService {
    ...
    }
    and then inject like this:

    Code:
      @Autowired
      @Autotaks
      TimeprisCollectorService timeprisCollectorService;
    which now fails in spring 3.0.3 :-(

    If I change it to:

    Code:
      @Resource(name = "autotaksTimeprisCollectorServiceImpl")
      TimeprisCollectorService timeprisCollectorService;
    it works, but it kinda defeats the purpose of the @Qualifier :-)

    Should I switch to JSR-330 @Inject with its qualifier instead?

  2. #2
    Join Date
    Jan 2007
    Posts
    7

    Default

    Ooh yeah, one important thing I forgot to mention:

    This fails from spring-mock 2.0.8 tests only!!! When the applicationContext is bootstrapped through a testcase that inherits for instance org.springframework.test.jpa.AbstractJpaTests is fails.

    Strange hugh?!

  3. #3
    Join Date
    Jan 2007
    Posts
    7

    Default

    Hmmm,...never mind. Converted to Junit4 and the SpringJUnit4ClassRunner which made the problem dissappear (still have no clue why it didn't work with spring-mock-2.0.8+spring-3.0.3).

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •