2017-08-22 54 views
3

私は、埋め込みのTomcatを備えたSpringブートアプリケーションを持っています。クラスパスで何かが変更された場合、spring-boot-devtoolsを使用してアプリケーションを再起動します。SpringBootアプリケーションは常に再起動します(restartループ) - spring.devtools

私のIDEは、春のツール・スイートであり、私はこれが私の問題は、TomcatとアプリケーションIST後に、それはすぐにすべてを再起動し始めたということであるリスタートに

をトリガーバックグラウンドでファイルを変更すると考えていたように私は、「自動的にビルド」の切り替え無限ループで:

2017-08-22 10:24:04.309 INFO 9772 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8055 (http) 
2017-08-22 10:24:04.415 DEBUG 9772 --- [ restartedMain] o.s.boot.devtools.restart.Restarter  : Creating new Restarter for thread Thread[main,5,main] 
2017-08-22 10:24:04.417 DEBUG 9772 --- [ restartedMain] o.s.boot.devtools.restart.Restarter  : Immediately restarting application 
2017-08-22 10:24:04.418 DEBUG 9772 --- [ restartedMain] o.s.boot.devtools.restart.Restarter  : Created RestartClassLoader org.sprin[email protected]558f3be6 
2017-08-22 10:24:04.419 DEBUG 9772 --- [ restartedMain] o.s.boot.devtools.restart.Restarter  : Starting application test.web.MyApplication with URLs 
2017-08-22 10:24:04.421 INFO 9772 --- [ restartedMain] test.web.MyApplication     : Started MyApplication in 22.347 seconds (JVM running for 24.103) 
2017-08-22 10:24:05.524 DEBUG 9772 --- [ File Watcher] o.s.boot.devtools.restart.Restarter  : Restarting application 
2017-08-22 10:24:05.527 DEBUG 9772 --- [  Thread-9] o.s.boot.devtools.restart.Restarter  : Stopping application 
2017-08-22 10:24:05.527 INFO 9772 --- [  Thread-9] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot[email protected]68f499a9: startup date [Tue Aug 22 10:23:43 CEST 2017]; root of context hierarchy 
2017-08-22 10:24:05.529 INFO 9772 --- [  Thread-9] o.s.j.e.a.AnnotationMBeanExporter  : Unregistering JMX-exposed beans on shutdown 
2017-08-22 10:24:05.537 INFO 9772 --- [  Thread-9] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 
2017-08-22 10:24:05.539 INFO 9772 --- [  Thread-9] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export 
2017-08-22 10:24:05.567 INFO 9772 --- [  Thread-9] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete 
2017-08-22 10:24:05.864 INFO 9772 --- [ost-startStop-2] org.apache.wicket.Application   : [wicket-filter] destroy: DevUtils DebugBar Initializer 
... 
2017-08-22 10:44:04.309 INFO 9772 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8055 (http) 
... 
2017-08-22 10:44:04.421 INFO 9772 --- [ restartedMain] test.web.MyApplication     : Started MyApplication in 22.347 seconds (JVM running for 24.103) 
2017-08-22 10:44:05.527 DEBUG 9772 --- [  Thread-9] o.s.boot.devtools.restart.Restarter  : Stopping application 

Workaroud:私は、私は、この動作を停止することができますが、それは本当に必要かどうもちろん、私は、再起動をしたいと思いspring.devtools.restart.enabled = falseと知っ

質問:

  • 変更は再起動をトリガするファイルを見つけるためにどのように?
  • 誰も同じような問題がありましたか?
+0

**無限ループ内ですべてをすぐに再起動します。**無限ループ?? –

+0

はい、それは無限ループです。ログにスタートアップとストップだけが表示されていましたが、停止後にすべてが再び開始されました。 – timguy

+1

おそらく、Tomcatはあなたのアプリケーションをサービスとして起動し、あなたのアプリケーションはおそらく急速に終了します(あなたの主な方法は何ですか?)。言い換えれば、バグではなく、機能です。そして、あなたはすでにそれを無効にする方法を知っています。 –

答えて

2

私は、アプリケーション起動直後の数秒後にSpring Boot DevToolsを使用してアプリケーションの再起動に関する問題を発見しました。

ログファイルフォルダはDevToolsによってスキャンされ、アプリケーションは起動後にこのフォルダにログを書き込むため、起動するたびにDevToolsを介してアプリケーション全体がリロードされました。

ソリューションはapplication.yml内の監視からのログフォルダを除外することです:

spring: 
    devtools: 
    restart: 
     exclude: logs/** 

you'reは、通常のプロパティファイルを使用している場合は、ちょうど同じですが、とit'sドットで(。)の間に。参考までにhttp://www.logicbig.com/tutorials/spring-framework/spring-boot/restart-exclude/も参照してください。

関連する問題