Spring Boot static content with context path
<p>I'm having problems with static content in Spring Boot when using a context path. i.e.: I wish to deploy my app to <code>localhost:8080/{appname}/</code></p>

<p>When I run the app without context path everything works fine and Spring Boot finds and runs my <code>.html</code> files (from resources/templates/, I'm using <code>Thymeleaf</code>) and JS files (from resources/static/js/) but when I add the context path with either:</p>

<pre><code>server.context-path=/{appname}
</code></pre>

<p>OR </p>

<pre><code>server.servlet-path=/{appname}
</code></pre>

<p>then the <code>.html</code> pages are still displayed by the JS files generate <strong>404 errors</strong>.</p>

<p>I have tried to change the <code>spring.resources.static-locations</code> in the <code>application.properties</code> and overriding <code>addResourceHandlers()</code> method in my <code>MvcConfig.class</code> but neither seem to work</p>

<p>I use a <code>MvcConfig</code> class because I need to define a <code>CookieLocaleResolver</code> and a <code>MessageSource</code> but that is all I have in the <code>MvcConfig</code>. I do not use <code>@EnableWebMvc</code> and just have the <code>@SpringBootApplication</code> annotation with a <code>@ComponentScan</code>.</p>

<p>Any help would be appreciated :)</p>