簡體   English   中英

如何正確有效地使用Google Guice

[英]How to use google guice appropriately and efficiently

我在一個網站上工作,我們使用Google Guice進行依賴注入。 現在,我們僅使用guice通過添加@ImplementedBy批注來隱式注入服務的構造函數。 代碼如下:

@ImplementedBy(ServiceImp.class)
public Interface Service{...}

public ServiceImpl{@Inject constructor()....}

Guice.createInjector().getInstance(Service.class)

我認為我們可能需要設定階段以及涉及績效的范圍或其他因素。 但是我不確定這一切。

誰能分享一些經驗?

我認為最佳做法部分會為您提供幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM