I have a base class that is extended by some other classes. Therefore I have to provide qualifiers for being able to inject a specific instance.
I wonder if I could mark any of these classes (eg the most upper class) as default class, which would be picked up if no qualifier is provided on @Autowired
?
@Service
//@Qualifier("Parent")
class ParentRunner;
@Service
@Qualifier("Child")
class ChildRunner extends ParentRunner;
The following does at least not work:
@Autowired
//@Qualifier("Parent")
private ParentRunner runner;
@Primary
which will then be used as default. See docs.spring.io/spring/docs/current/javadoc-api/org/… – Okun