title: Set tracking mode to cookie to remove appended session id, without using web.xml
body: <p>I am setting up a completely java based spring app with no xml config :</p>
  
  <pre><code>public class WebApp extends AbstractAnnotationConfigDispatcherServletInitializer {
      @Override
      protected Class&lt;?&gt;[] getRootConfigClasses() {
          return null;
      }
      @Override
      protected Class&lt;?&gt;[] getServletConfigClasses() {
          return new Class&lt;?&gt;[]{WebMvcConfigurer.class};
      }
      @Override
      protected String[] getServletMappings() {
          return new String[]{"/"};
      }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan(basePackages = { mypackages })
  public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
  
      @Override
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler("/resources/**").addResourceLocations("/static-assets/");
      }
  
      @Bean
      public ViewResolver viewResolver() {
  
          InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
          viewResolver.setViewClass(JstlView.class);
          viewResolver.setPrefix("/WEB-INF/views/");
          viewResolver.setSuffix(".jsp");
          return viewResolver;
      }
  </code></pre>
  
  <p>where do I put this, which used to be in my web.xml ?</p>
  
  <pre><code> &lt;session-config&gt;
          &lt;!-- Disables URL-based sessions (no more 'jsessionid' in the URL using Tomcat) --&gt;
          &lt;tracking-mode&gt;COOKIE&lt;/tracking-mode&gt;
      &lt;/session-config&gt;
  </code></pre>