且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Intellij + Springboot + Thymeleaf + gradle - 自动重新加载html资源

更新时间:2022-10-22 21:42:54

在添加注册表设置后出现:

  compilier.automake.allow.when.app.running 

您不仅需要重启Springboot服务器,还要重启Intellij。



现在就开始。


I am using IntelliJ Ultimate, Spring Boot, and Thymeleaf.

I want to enable auto-reload of HTML without restarting the server and without CTRL-F9.

I have read the following already and I think it should be working, but it's not:

I have done the following steps:

build.gradle snippet

compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: '1.5.2.RELEASE'
compile("org.springframework.boot:spring-boot-devtools")
runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
}

bootRun {
    addResources = true
}

IntelliJ Settings for Compilier:

And Intellij Registry Setting:

My HTML is in main\resources\templates and my application.properties is in \resources\

I then have tried both running and debugging the project but either way, I still have to rebuild (CTRL-F9) between changes to the HTML.

Reading here from snicoll and dsayer this should be possible without the CTRL-F9:

It appears after adding the registry setting :

compilier.automake.allow.when.app.running 

You need to restart not only the Springboot server but Intellij too.

It is going now.