Hi all,
I'm facing a problem trying to use the injection mechanism between two
modules.
I have a Module A with the following classes:
Module A
--------
public class Machine {
@Inject Part part;
}
class Part {
@Inject Config config;
}
interface Config { }
Part is not public and is a requirement to build Machines. Part has a
dependency on Config. But the Config implementation is not defined in
Module A.
I have another Module B depending on Module A with the following classes:
Module B
--------
public class ConfigImpl implements Config {
@Inject @Assisted Source source;
}
interface Source { }
interface ConfigFactory {
create(Source source);
}
The ConfigImpl class requires a Source object to be instantiated. The
ConfigFactory must be used for this job, but the Machine class doesn't
know about the ConfigFactory interface. Also, doesn't make sense to
include the Source and ConfigFactory interfaces in Module A.
How could I solve this DI problem? I'm sure I have to rethink the design
of those classes. So, I would appreciate if you could provide any
directions.
Cheers,
Henrique
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.