Browse Source

WebMvcConfigurerAdapter->WebMvcConfigurer

Fixes gh-4612
pull/4761/head
Rob Winch 8 years ago
parent
commit
5280ac40e9
  1. 6
      config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfiguration.java
  2. 6
      config/src/main/java/org/springframework/security/config/annotation/web/servlet/configuration/WebMvcSecurityConfiguration.java
  3. 4
      config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java
  4. 2
      docs/guides/src/docs/asciidoc/form-javaconfig.asc
  5. 6
      docs/manual/src/docs/asciidoc/index.adoc
  6. 4
      samples/javaconfig/messages/src/main/java/org/springframework/security/samples/mvc/config/WebMvcConfiguration.java

6
config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfiguration.java

@ -28,7 +28,7 @@ import org.springframework.security.web.method.annotation.CsrfTokenArgumentResol @@ -28,7 +28,7 @@ import org.springframework.security.web.method.annotation.CsrfTokenArgumentResol
import org.springframework.security.web.servlet.support.csrf.CsrfRequestDataValueProcessor;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.support.RequestDataValueProcessor;
/**
@ -41,7 +41,7 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor; @@ -41,7 +41,7 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor;
* @author Rob Winch
* @since 3.2
*/
class WebMvcSecurityConfiguration extends WebMvcConfigurerAdapter implements ApplicationContextAware {
class WebMvcSecurityConfiguration implements WebMvcConfigurer, ApplicationContextAware {
private BeanResolver beanResolver;
@Override
@ -64,4 +64,4 @@ class WebMvcSecurityConfiguration extends WebMvcConfigurerAdapter implements App @@ -64,4 +64,4 @@ class WebMvcSecurityConfiguration extends WebMvcConfigurerAdapter implements App
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.beanResolver = new BeanFactoryResolver(applicationContext.getAutowireCapableBeanFactory());
}
}
}

6
config/src/main/java/org/springframework/security/config/annotation/web/servlet/configuration/WebMvcSecurityConfiguration.java

@ -23,7 +23,7 @@ import org.springframework.security.web.method.annotation.AuthenticationPrincipa @@ -23,7 +23,7 @@ import org.springframework.security.web.method.annotation.AuthenticationPrincipa
import org.springframework.security.web.servlet.support.csrf.CsrfRequestDataValueProcessor;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.support.RequestDataValueProcessor;
/**
@ -38,7 +38,7 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor; @@ -38,7 +38,7 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor;
* @since 3.2
*/
@EnableWebSecurity
public class WebMvcSecurityConfiguration extends WebMvcConfigurerAdapter {
public class WebMvcSecurityConfiguration implements WebMvcConfigurer {
@Override
@SuppressWarnings("deprecation")
@ -52,4 +52,4 @@ public class WebMvcSecurityConfiguration extends WebMvcConfigurerAdapter { @@ -52,4 +52,4 @@ public class WebMvcSecurityConfiguration extends WebMvcConfigurerAdapter {
public RequestDataValueProcessor requestDataValueProcessor() {
return new CsrfRequestDataValueProcessor();
}
}
}

4
config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java

@ -38,7 +38,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -38,7 +38,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
*
@ -92,7 +92,7 @@ public class HttpSecurityHeadersTests { @@ -92,7 +92,7 @@ public class HttpSecurityHeadersTests {
@EnableWebMvc
@Configuration
static class WebMvcConfig extends WebMvcConfigurerAdapter {
static class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/resources/").setCachePeriod(12345);

2
docs/guides/src/docs/asciidoc/form-javaconfig.asc

@ -143,7 +143,7 @@ Within Spring Web MVC, the first step is to ensure that we have a controller tha @@ -143,7 +143,7 @@ Within Spring Web MVC, the first step is to ensure that we have a controller tha
@EnableWebMvc
@ComponentScan("org.springframework.security.samples.mvc")
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
public class WebMvcConfiguration implements WebMvcConfigurer {
// ...

6
docs/manual/src/docs/asciidoc/index.adoc

@ -440,7 +440,7 @@ import org.springframework.security.config.annotation.authentication.builders.*; @@ -440,7 +440,7 @@ import org.springframework.security.config.annotation.authentication.builders.*;
import org.springframework.security.config.annotation.web.configuration.*;
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public class WebSecurityConfig implements WebMvcConfigurer {
@Bean
public UserDetailsService userDetailsService() throws Exception {
@ -3927,7 +3927,7 @@ When using Spring Web MVC, this is typically done within your configuration. For @@ -3927,7 +3927,7 @@ When using Spring Web MVC, this is typically done within your configuration. For
[source,java]
----
@EnableWebMvc
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
public class WebMvcConfiguration implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
@ -6868,7 +6868,7 @@ NOTE: As of Spring Security 4.0, `@EnableWebMvcSecurity` is deprecated. The repl @@ -6868,7 +6868,7 @@ NOTE: As of Spring Security 4.0, `@EnableWebMvcSecurity` is deprecated. The repl
To enable Spring Security integration with Spring MVC add the `@EnableWebSecurity` annotation to your configuration.
NOTE: Spring Security provides the configuration using Spring MVC's http://docs.spring.io/spring-framework/docs/4.1.x/spring-framework-reference/htmlsingle/#mvc-config-customize[WebMvcConfigurerAdapter]. This means that if you are using more advanced options, like integrating with `WebMvcConfigurationSupport` directly, then you will need to manually provide the Spring Security configuration.
NOTE: Spring Security provides the configuration using Spring MVC's https://docs.spring.io/spring/docs/5.0.0.RELEASE/spring-framework-reference/web.html#mvc-config-customize[WebMvcConfigurer]. This means that if you are using more advanced options, like integrating with `WebMvcConfigurationSupport` directly, then you will need to manually provide the Spring Security configuration.
[[mvc-requestmatcher]]
=== MvcRequestMatcher

4
samples/javaconfig/messages/src/main/java/org/springframework/security/samples/mvc/config/WebMvcConfiguration.java

@ -26,7 +26,7 @@ import org.springframework.web.servlet.ViewResolver; @@ -26,7 +26,7 @@ import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
@ -35,7 +35,7 @@ import org.thymeleaf.templatemode.TemplateMode; @@ -35,7 +35,7 @@ import org.thymeleaf.templatemode.TemplateMode;
@EnableWebMvc
@ComponentScan("org.springframework.security.samples.mvc")
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
public class WebMvcConfiguration implements WebMvcConfigurer {
@Autowired
private ApplicationContext applicationContext;

Loading…
Cancel
Save