Spring boot and Thymeleaf - Hot swap templates and resources once again
<p>I tried all tips and tricks that I found here and in docs, but still no luck. I have Spring webapp with Thymeleaf. Resources and templates are not reloaded when I call update in IDEA (it says nothing to reload). I can then press ctrl+f5 in a browser like crazy, changes are just not there.</p>

<p>Everything is configured in one Java class like this:</p>

<pre><code>@EnableWebMvc
public class MvcConfig extends WebMvcConfigurerAdapter implements ApplicationContextAware {
</code></pre>

<p>My folder structure now looks like
<a href="https://i.stack.imgur.com/JFKWb.png" rel="noreferrer">this</a>, but I also tried to put the resources without "static" folder or to webapp/resources.</p>

<p>ResourceHandlerRegistry:</p>

<pre><code>@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
    super.addResourceHandlers(registry);
    registry.addResourceHandler("/img/**").addResourceLocations("classpath:/static/img/");
    registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
    registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
}
</code></pre>

<p>I specified cache=false in both application.properties:</p>

<pre><code>spring.thymeleaf.cache=false
</code></pre>

<p>and in mentioned MvcConfig class:</p>

<pre><code>@Bean
public SpringResourceTemplateResolver templateResolver() {
    SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
    templateResolver.setApplicationContext(this.applicationContext);
    templateResolver.setPrefix("/WEB-INF/templates/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode(TemplateMode.HTML);
    templateResolver.setCacheable(false);
    return templateResolver;
}
</code></pre>

<p>According to some answers on SO i added dependency for devtools:</p>

<pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
    &lt;version&gt;1.4.1.RELEASE&lt;/version&gt;
    &lt;optional&gt;true&lt;/optional&gt;
&lt;/dependency&gt;
</code></pre>

<p>Still not working. Some said to add maven boot plugin with addResources=true, so I did:</p>

<pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.4.1.RELEASE&lt;/version&gt;
    &lt;configuration&gt;
        &lt;addResources&gt;true&lt;/addResources&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;
</code></pre>

<p>My Idea is set properly I guess, because when I call update, my Java classes are reloaded immediately. Only resources and html files are not, I must restart server for it. Actualy *.html files are not so big a deal, but to restart server after every small css and js change is slowing me down a lot, and as I lost almost 15 hours figuring out what is wrong, it started to be really frustrating.</p>

<p>Any help will be greatly appreciated.</p>