![](/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.