Spring Boot - encoding of static resources
<p>I configured a specific folder (<code>c:\data\cache\&lt;html files&gt;</code>) to be served statically by Spring Boot like this:</p>

<pre><code>@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("cache/**")
            .addResourceLocations("file:data/cache/");
}
</code></pre>

<p>These HTML files are being served well. The problem is the encoding. They're properly saved (as <code>Windows-1252</code> - downloaded from a website). When I open them directly from disk in browser they're fine. But when Spring Boot serves them, it forces <code>UTF-8</code>.</p>

<p>I saw a solution to change that - it works - but it changes the encoding to <code>UTF-8</code> for every HTML:</p>

<pre><code>@Override
public void customize(ConfigurableEmbeddedServletContainer factory) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    mappings.add("html", "text/html;charset=windows-1252");
    factory.setMimeMappings(mappings);
}
</code></pre>

<p><strong>But then my regular non-static pages gets served as <code>Windows-1252</code></strong>.
So I have to choose one or the other.</p>

<p>Is there any way to tell Spring to serve the static HTML "as is" (or manually specify the encoding)?</p>

<p>Thanks</p>