小编Ste*_*ers的帖子

Google App Engine、Spring Boot 应用程序不断重启

我正在尝试构建一个 Spring Boot REST API 并将其托管在 Google 的 App Engine 上。我在工作中的项目中更喜欢 gradle,所以我选择使用 Gradle。文档很难浏览。

我终于得到了正确的 gradle 文件和正确的 app.yaml 配置。但是我的 Spring Boot 应用程序只是在 App Engine 上不断重启。无论任何外部影响如何,它都会自动重新启动(点击端点时没有错误;该应用程序就像在本地一样工作......持续几秒钟)。

我很难调试它。

这是再次重新启动之前的最后几条日志。看起来 SpringFrameworkServlet 导致了问题并使其重新启动?因为我的代码中没有任何 Servlet,但我很确定 App Engine 已经将 Servlet 融入到它的 Java docker 容器中。

A  2017-04-25 14:01:26.604  INFO 1 --- [           main] o.s.d.r.w.BasePathAwareHandlerMapping    : Mapped "{[/profile/{repository}],methods=[GET],produces=[application/schema+json]}" onto public org.springframework.http.HttpEntity<org.springframework.data.rest.webmvc.json.JsonSchema> org.springframework.data.rest.webmvc.RepositorySchemaController.schema(org.springframework.data.rest.webmvc.RootResourceInformation)

A  2017-04-25 14:01:27.362  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup

A  2017-04-25 14:01:28.937  INFO 1 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : …
Run Code Online (Sandbox Code Playgroud)

google-app-engine spring-boot

4
推荐指数
1
解决办法
1465
查看次数

带延迟的jQuery toggle类只能运行一次

在jQuery,匿名函数和延迟方面,我显然缺少一些基本的东西.

以下代码仅适用于每页加载ONCE(它将添加该类,然后在1秒后删除它,如果我再次单击,它将添加该类,但绝不会在页面持续时间内删除该类,除非我重新加载页面):

var jElement = $(currElem);
jElement.addClass("highlight")
.delay(1000)
.queue(function(){
$(this).removeClass("highlight");
});
Run Code Online (Sandbox Code Playgroud)

然而,

如果我将(不存在的)函数调用作为参数添加,并且我在我的匿名函数中调用它,那么添加/删除类组合将无限期地工作.

var jElement = $(currElem);
jElement.addClass("highlight")
.delay(1000)
.queue(function(randomFunction){
$(this).removeClass("highlight");
randomFunction(); //this makes it seemingly 'miraculously' work??
});
Run Code Online (Sandbox Code Playgroud)

边注:

var jElement = $(currElem);
jElement.addClass("highlight")
.delay(1000)
.queue(function(randomFunction){
$(this).removeClass("highlight");
// this does NOT work; if I dont actually call the 'randomFunction'
// so that function, even though it does nothing; must somehow cause 
// the implicit call of 'dequeue()' ??
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery anonymous-function

3
推荐指数
1
解决办法
2075
查看次数