Question

Is there a way to publish the web-content in a spring boot application without restarting the whole application?

I use thymeleaf have tried to set the "spring.template.cache" property to false but with no luck

Was it helpful?

Solution

Setting spring.template.cache is enough if you run application with mvn spring-boot:run.

I am not sure about other IDE's, but in case of running application from Intellij IDEA in order to refresh Thymeleaf templates you need to Make Project (Cmd+F9 on Mac) each time you want to see changes.

OTHER TIPS

if you are building jar file, then first Change jar to war in build.gradle as fallows:

apply plugin: 'war'
War{
baseName= 'projectName'
version='0.1.0'
}

add the following statement in dependencies

providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")

add this class in your controller package.

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

It worked for me..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top