![](/img/trans.png)
[英]Can I use @Transactional from Guice with Google App Engine's Datastore?
[英]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.