Here\'s my problem:
It\'s first important to know that I\'m writing a simulation. This is a standalone application, and is single-threaded. I have essentially two
Have you considered using a provider? It would be easy to write one that meets your requirements, e.g.:
import com.google.inject.Provider
class RootObjectProvider implements Provider {
...
@Override
RootObject get() {
ClassD d = new ClassD( .... );
ClassB b = new ClassB( ..., d, ...);
ClassC c = new ClassC( ..., d, ...); // Note that b and c share d.
return new RootObject(b, c, ...);
}
}
You can use the provider two ways:
@Provides interface or the .toProvider() binding decoration.RootObject instances as needed.Hope that this helps.