I have the following scenario:
public interface ServiceClientAdapter {
SomeData getSomeData()
}
@LegacyServiceClientAdapter
public class MyLegacyServiceClientAdapterImpl implements
ServiceClientAdapter {
public SomeData getSomeData() {
// implementation
}
}
@NewServiceClientAdapter
public class MyNewServiceClientAdapterImpl implements
ServiceClientAdapter {
public SomeData getSomeData() {
// implementation
}
}
public class BusinessLogic {
@Inject
private ServiceClientAdapter serviceClientAdapter;
}
LegacyServiceClientAdapter and NewServiceClientAdapter are custom
annotations.
The implementation for the serviceClientAdapter field will be determined at
runtime by whether the user has been migrated from the legacy to the new
service or not.
What is the best way to accomplish this dependency injection using Google
Guice?
Take into account that different BusinessLogic classes will exist, each
with their own (different) ServiceClientAdapter-like interface and
corresponding legacy and new implementation classes.
Ideally this should be done with a piece of framework code that can be used
across all use cases.
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-guice/16c5a15a-7508-460e-b513-23f22e50d3f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.