How to use google guice appropriately and efficiently
I am working on a web site and we use the Google Guice for the Dependence Inject开发者_C百科ion. Now we just use the guice to inject the constructor of the services implicitly by adding the @ImplementedBy
annotation. The code is such as:
@ImplementedBy(ServiceImp.class)
public Interface Service{...}
public ServiceImpl{@Inject constructor()....}
Guice.createInjector().getInstance(Service.class)
I think we may need to set the stage and the scope or other factor involves in the performance. But I am not sure about all of this.
Could anyone share some experience?
I think Best practice section will help you.
精彩评论