开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜