Hi all! I've been reading this forums a lot and it has been really helpful for me and for my work. So before anything, thank you all for share your knowledge. I hope I can help around here a little bit with mine.

I'm having a real challenge (at least for me) at my work with one of our new web applications.

Our service model consist of a new set of services -An Spring security custom service for example or a passwordEncoder- and a legacy set of services which are instantiated through a custom ServiceFactory. This legacy services are divided in several different domains.

What I want to achieve is to autowire the new set of services just as Spring does already and integrate a custom service factory in order to autowire the legacy services by looking for the implementation in my custom service factory.

Our custom Service Factory already exists and it receives 2 parameters, the domain and the interface.

For instance:

For example I have this controller:
Code:
@Controller
public class myController {
@Autowired {domain = ABC}
private LegacyServiceDomainABC legacyService1;
@Autowired {domain = DEF}
private LegacyServiceDomainDEF legacyService2;
@Autowired
private IUnrelatedPasswordEncoder passwordEncoder; 
}
Is there any way to achieve this? what would be the less performance kill approach?

Of course I'm not asking for code, just some guidelines, tips, or where should I look more.

We can't drop the legacy set of services nor the way of instantiation since it would involve reimplement lots of magic and business logic.

Thanks in advance!

Regards

Matias