title: Spring boot serving static resource - sitemap.xml
body: <p>I work on spring boot 1.3.3.RELEASE with  JSP as view technology. </p>
  
  <p>JSP pages , static resources like CSS, JS and images are loading properly. But how to serve static resource like txt or xml (robots.txt, sitemap.xml) </p>
  
  <p>My controller is handling the request and trying to render jsp view.</p>
  
  <p>Application.java</p>
  
  <pre><code>@SpringBootApplication
  public class SampleWebJspApplication extends SpringBootServletInitializer {
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(SampleWebJspApplication.class);
      }
  
      public static void main(String[] args) throws Exception {
          SpringApplication.run(SampleWebJspApplication.class, args);
      }
  
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>@Controller
  public class WelcomeController {
  
      @RequestMapping(value = "/{name}")
      public String welcome(@PathVariable String name) {       
          return name;
      }
  }
  </code></pre>
  
  <p>application.properties</p>
  
  <pre><code>spring.mvc.view.prefix: /WEB-INF/jsp/
  spring.mvc.view.suffix: .jsp
  </code></pre>
  
  <p>Following URL's handled by controller and it renders home.jsp</p>
  
  <pre><code>/home  
  /home.css
  /home.js
  /home.txt 
  /home.xml 
  </code></pre>
  
  <p>Following URL's Not working </p>
  
  <pre><code>/home.jsp - 404 
  /robots.txt - 404 - trying to render robots.jsp
  /sitemap.xml - 404 - trying to render sitemap.jsp
  </code></pre>