• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Qualifier annotation in Spring Boot does not work for the class that extends another one

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this hierarchy:



In the line below class A is injected not Y ( I need Y ):



Could you please tell me how to do in Spring Boot to inject class Y ?
The problem probably is that class A has @Primary annotation but does @Qualifier not have a priority ?


 
Rancher
Posts: 100
4
VI Editor Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Qualifier has indeed higher priority than @Primary. Works as expected for me with sample program according to your structure. Do you have all those classes in scope of Spring's component scan?

// Edit: You should have class A in scope of component scan, otherwise bean would not be found, but check if class Y is in scope of component scan.
 
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bronishlav,
Please try to add @Autowired to see if it can autowire your Y bean
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic