更改排除的文件时,Spring Devtools触发重新启动 [英] Spring Devtools triggers restart when changing excluded files

查看:452
本文介绍了更改排除的文件时,Spring Devtools触发重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用JoinfacesPrimefaces的Spring Boot Web项目.该应用程序从SpringBootServletInitializer扩展,并且还生成一个war文件.

I have a Spring Boot Web Project that uses Joinfaces and Primefaces. The application extends from SpringBootServletInitializer and also generates a war file.

对于开发,我使用RunAs -> Spring Boot App启动我的项目(在Eclipse中).我已经按照

For development I start my Project (in Eclipse) using RunAs -> Spring Boot App. I've added the spring-boot-devtools dependency as described in the Developer Tools Docu. Everything seems to work, except that changes in a xhtml file also triggers the restart.

我在我的application.yml中添加了spring.devtools.restart.additional-exclude属性,也排除了webapp/**.但这似乎没有效果,因为更改仍然会触发重新启动.

I've added the spring.devtools.restart.additional-exclude property in my application.yml to exclude also webapp/**. But this seems to have no effect, because a change still triggers the restart.

spring:
  devtools:
    restart:
      additional-exclude: webapp/**

我的项目结构如下:

src
 -main
  -java
  -resources
  -webapp
   - *.xhtml

但是也许我不明白如何正确使用DevTools-以Spring Boot App身份启动应用程序可能不是正确的用法?因为如果我放置一个文件例如src/main/resources下的foo.txt并更新其内容,应用程序也将重新启动(使用DevTools默认值(应排除

But maybe I do not understand how to use the DevTools correct - Starting the application as Spring Boot App might not be the correct usage? Because if I place a file e.g. foo.txt under src/main/resources and update its content the application is also restarted (using the DevTools defaults (which should exclude /resources)).

使用:

  • Eclipse Oxygen.3a发行版(4.7.3a)
  • Joinfaces 3.2.1-> Spring Boot 2.0.2.RELEASE

推荐答案

解决我的主要问题可能相对容易.

The solution to my main problem might be relatively easy.

我在Eclipse中将webapp文件夹添加为Source Folder.从源文件夹列表中删除该文件夹后,当我更改xhtml文件中的某些内容时,不再触发重新加载.

I've added the webapp folder as Source Folder in Eclipse. As soon as I've removed the folder from the list of source folders, the reload was no longer triggered when I changed something in the xhtml files.

这个答案给了我一个想法,即源文件夹可能是问题所在.

This answer gave me the idea, that the source folder might be the problem.

这篇关于更改排除的文件时,Spring Devtools触发重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆