【发布时间】:2019-06-13 05:55:00
【问题描述】:
我正在尝试在带有 Cloud Tools SDK 的 Eclipse 中的 App Engine 项目中使用 Objectify。 Objectify 的 GitHub wiki 的设置部分说:
在应用程序的引导程序中调用
ObjectifyService.init();一种 servlet 上下文监听器是理想的。
我发现的每个教程或问题都说同样的话,但 Eclipse 告诉我 ObjectifyService.init() 方法不存在。下面的代码来自 Objectify GitHub wiki。
public class Bootstrapper implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
ObjectifyService.init(); //"The method init() is undefined for the type ObjectifyService"
ObjectifyService.register(MyClass.class);
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
// TODO Auto-generated method stub
}
}
是否不再需要此调用?所有的教程,甚至看起来像官方文档的东西,都过时了吗?
【问题讨论】:
标签: java google-app-engine google-cloud-platform objectify