title: Spring Security Java Config not generating logout url
body: <p>I am using Spring <strong>4.0.5.RELEASE</strong> and Spring Security <strong>3.2.4</strong>.</p>
  
  <p>I am trying to create a simple sample app using java config (based on the Spring samples). The app starts up and the authentication works correctly, that is, I am redirected to a login form when accessing protected url <strong>/settings/profile</strong></p>
  
  <p>However there is no <strong>/logout</strong> url generated? if I hit localhost:8080/logout I get a 404.</p>
  
  <p>I've used similar code on a previous project, so maybe has something to do with versions?</p>
  
  <p>Heres my Security Config</p>
  
  <pre><code>@Configuration
  @EnableWebMvcSecurity
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Autowired
      public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
          auth.inMemoryAuthentication().withUser("user").password("password").roles("USER");
          auth.inMemoryAuthentication().withUser("admin").password("password").roles("ADMIN");
      }
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http.authorizeRequests()
                  .antMatchers("/settings/**").hasRole("ROLE_ADMIN")
                      .and()
                  .formLogin()
                      .and()
                  .logout()
                      .deleteCookies("remove")
                      .invalidateHttpSession(true)
                      .logoutUrl("/logout")
                      .logoutSuccessUrl("/logout-success")
                  .permitAll();
      }
  }
  </code></pre>
  
  <p>Here is my WebAppInitializer to bootstrap the app</p>
  
  <pre><code> public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  
      @Override
      protected Class&lt;?&gt;[] getRootConfigClasses() {
          return new Class&lt;?&gt;[] { SecurityConfig.class , MvcConfig.class };
      }
  
      @Override
      protected Class&lt;?&gt;[] getServletConfigClasses() {
          return null;
      }
  
      @Override
      protected String[] getServletMappings() {
           return new String[] {"/"};
      }
  }
  </code></pre>
  
  <p>and finally my MvcConfig</p>
  
  <pre><code>@EnableWebMvc
  @Configuration
  @ComponentScan(basePackages = {"web"})
  public class MvcConfig extends WebMvcConfigurerAdapter {
  
      @Bean
      public ViewResolver viewResolver() {
          InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
          viewResolver.setViewClass(JstlView.class);
          viewResolver.setPrefix("/WEB-INF/views");
          viewResolver.setSuffix(".jsp");
          return viewResolver;
      }
  }
  </code></pre>