更改排除的文件时,Spring Devtools触发重新启动 [英] Spring Devtools triggers restart when changing excluded files
问题描述
我有一个使用Joinfaces
和Primefaces
的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屋!