I am trying to allow a runtime slice to decide which interface implementation should be used, preferably exclusively by auto-tuning.
I tried to make a factory object for thet interface that uses dynamic proxies, and I used qualifiers to force @Autowired injections to use factory. Qualifiers are necessary because both factory and implementations respond to the same interface.
The problem is that I am ending annotating each @Autowired link with @Qualifier. What I really would like to do is annotate non-factory implementations with something like @NotCandidateForAutowiringByInterface (my fantasy annotation) or even better make spring the preferred single unqualified bean when injected into an un- qualified field
I can think of completely wrong lines here, so alternative suggestions are welcome. Does anyone know how to do this?
java spring
krosenvold
source share