All
I have two classes, Cache and CacheMonitor. If someone binds the Cache I
want the CacheMonitor to be initiated.
Currently I have the Cache class depend on the CacheMonitor but this
creates a unnecassary dependency, the Cache should be able to be used
without the CacheMonitor.
Is there
Maybe you want to make CacheMonitor an optional dependency?
See: https://github.com/google/guice/wiki/Injections#optional-injections
On Thu, Sep 10, 2015 at 7:00 AM Michiel ten Hagen
wrote:
> All
>
> I have two classes, Cache and CacheMonitor. If someone binds the
An idiomatic solution is to create a CacheModule which you would ask
clients of Cache to install.
Within the module you would:
1. create the binding for Cache
2. add any additional logic for your CacheMonitor
Not knowing anything about either of these classes it's difficult to say
what