-1

我用端点启动谷歌应用引擎,我使用objectify来持久化,我有一个小问题。(我希望!)

我所有的 apiMethod 都是这样开始的:

@ApiMethod(path = "getAccount", httpMethod = HttpMethod.GET)
public Account getAccount(@Named("idPlayer") long idPlayer) {
    ObjectifyLoader.loadEntity();

ObjectifyLoader.loadEntity(); 只是一种类似的方法

   public static void loadEntity(){
    ObjectifyService.register(Account.class); 
    ObjectifyService.register(WeaponsAccount.class); 
}

我的印象是我注册了我的课程以及每次调用 api。

只加载一次的提示?

谢谢你的阅读。法比奇

4

1 回答 1

0

你想使用一个ServletContextListener. 查看此App Engine oage以获取示例。

于 2017-12-07T00:38:23.217 回答