簡體   English   中英

如何使用Guice注入Google App Engine數據存儲區?

[英]How to inject Google App Engine datastore with Guice?

我正試圖通過Guice將Google App Engine的數據存儲注入我的服務中:

public class FooServiceImpl implements FooService {

    private final DatastoreService datastoreService;

    @Inject
    public FooServiceImpl (DatastoreService datastoreService) {
        this.datastoreService = datastoreService;
    }
}

但是當我嘗試運行它時,我收到以下錯誤:

沒有綁定com.google.appengine.api.datastore.DatastoreService的實現。

@Provides方法添加到您的模塊:

@Provides
DatastoreService provideDatastoreService(){
    return DatastoreServiceFactory.getDatastoreService();
}

暫無
暫無

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

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