在spring启动应用程序中发布web内容

在spring启动应用程序中发布web内容,web,thymeleaf,spring-boot,Web,Thymeleaf,Spring Boot,有没有一种方法可以在spring启动应用程序中发布web内容而不重新启动整个应用程序 我使用thymeleaf尝试将“spring.template.cache”属性设置为false,但运气不佳如果使用mvn spring boot:run运行应用程序,设置spring.template.cache就足够了 我不确定是否还有其他IDE,但如果要从Intellij IDEA运行应用程序以刷新Thymeleaf模板,您需要在每次希望看到更改时创建Project(Cmd+F9,在Mac上)。如果您正在

有没有一种方法可以在spring启动应用程序中发布web内容而不重新启动整个应用程序


我使用thymeleaf尝试将“spring.template.cache”属性设置为false,但运气不佳

如果使用
mvn spring boot:run运行应用程序,设置
spring.template.cache
就足够了


我不确定是否还有其他IDE,但如果要从Intellij IDEA运行应用程序以刷新Thymeleaf模板,您需要在每次希望看到更改时创建Project
Cmd+F9
,在Mac上)。如果您正在构建jar文件,则首先在build.gradle中将jar更改为war作为休耕:

apply plugin: 'war'
War{
baseName= 'projectName'
version='0.1.0'
}
在依赖项中添加以下语句

providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
在控制器包中添加此类

public class ServletInitializer extends SpringBootServletInitializer
{
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Application.class);
    }
}

这对我很管用

spring.template.cache
仅适用于thymeleaf模板(名称中的线索),我假设它是有效的,因为其他人使用它。可能您要重新加载的内容没有被thymeleaf加载?或者您设置了自己的thymeleaf配置,但没有使用默认设置?