This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RedisClientProviderModule extends AbstractModule { | |
@Override | |
protected void configure() { | |
bind(RedisClient).toProvider(RedisClientProvider).in(Singleton.class); | |
} | |
} | |
public class RedisClientProvider implements Provider<RedisClient> { | |
@Inject | |
public RedisClientProvider(AClass clazz) { | |
// Create instance of RedisClient | |
} | |
@Override | |
public RedisClient get() { | |
// return instance of RedisClient | |
} | |
} | |
public FooBar { | |
@Inject | |
public FooBar(RedisClient client) { | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment