question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to reload templates without restarting the spring boot application?

See original GitHub issue

I deploy my spring boot application with maven by spring-boot:run in intellij-idea. I must restart my application after I update the template files. Is there some methods that can update templates automatically instead of restarting the application?

I have already putted spring-boot-devtools in pom.xml:

        <!-- hot swap -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <version>1.3.0.RELEASE</version>
            <optional>true</optional>
        </dependency>

p.s: sorry, maybe there are some grammar errors. English isn’t my native language.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

49reactions
vanduc1102commented, Feb 1, 2020

I found from the tutorial here: https://attacomsian.com/blog/spring-boot-auto-reload-thymeleaf-templates it works for me when i added both

spring.thymeleaf.cache=false
spring.thymeleaf.prefix=file:src/main/resources/templates/
38reactions
danielfernandezcommented, May 13, 2017

Spring Boot offers a spring.thymeleaf.cache configuration property which you can set to false if you want to disable the template cache so that templates can be modified on the fly.

Note however that Maven’s spring-boot:run does run templates from the generated überjar, so I don’t think this would work. However, if you run your application from IntelliJ IDEA by selecting the application class and choosing Run... (you seem to cite these two methods as the same thing but they are actually different ways to start your app), then you should be able to see changes in your templates simply by asking IntelliJ to build the project (⌘+F9 in macOS, Ctrl+F9in Windows).

Read more comments on GitHub >

github_iconTop Results From Across the Web

spring - Live reload for thymeleaf template - Stack Overflow
"Live reload" in terms of Spring Boot applications means that you do not need to restart your application server after editing your html....
Read more >
84. Hot swapping - Spring
84.2 Reload templates without restarting the container ... The spring-boot-devtools module includes support for automatic application restarts.
Read more >
Spring Boot & IntelliJ IDEA: Auto reload Thymeleaf templates ...
A detailed article to learn how to auto-reload Thymeleaf templates without restarting the Spring Boot application in IntelliJ IDEA.
Read more >
Spring Boot and Thymeleaf: Reload templates and static ...
Assuming the all templates are in the path specified, changing them will require a page refresh but not application / server restart. Both ......
Read more >
Spring Boot auto reload changes using LiveReload and ...
Add the dependency spring-boot-devtools to your project's build file (pom.xml). · Install LiveReload extension for your browser. · Restart your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found