Replace usage of WebMvcConfigurerAdapter

Closes gh-8964
pull/9497/head
Madhura Bhave 8 years ago
parent ec57c3d92a
commit c2e5fd031a

@ -21,7 +21,7 @@ import org.springframework.boot.actuate.endpoint.EndpointProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.util.Assert;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Abstract base class for {@link MvcEndpoint} implementations without a backing
@ -31,8 +31,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
* @author Lari Hotari
* @since 1.4.0
*/
public abstract class AbstractMvcEndpoint extends WebMvcConfigurerAdapter
implements MvcEndpoint, EnvironmentAware {
public abstract class AbstractMvcEndpoint
implements MvcEndpoint, WebMvcConfigurer, EnvironmentAware {
private Environment environment;

@ -39,7 +39,7 @@ import org.springframework.data.neo4j.transaction.Neo4jTransactionManager;
import org.springframework.data.neo4j.web.support.OpenSessionInViewInterceptor;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data Neo4j.
@ -108,14 +108,14 @@ public class Neo4jDataAutoConfiguration {
@Configuration
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass({ WebMvcConfigurerAdapter.class,
@ConditionalOnClass({ WebMvcConfigurer.class,
OpenSessionInViewInterceptor.class })
@ConditionalOnMissingBean(OpenSessionInViewInterceptor.class)
@ConditionalOnProperty(prefix = "spring.data.neo4j", name = "open-in-view", havingValue = "true", matchIfMissing = true)
protected static class Neo4jWebConfiguration {
@Configuration
protected static class Neo4jWebMvcConfiguration extends WebMvcConfigurerAdapter {
protected static class Neo4jWebMvcConfiguration implements WebMvcConfigurer {
@Bean
public OpenSessionInViewInterceptor neo4jOpenSessionInViewInterceptor() {

@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoCon
import org.springframework.context.annotation.Configuration;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's web support.
@ -41,7 +41,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@EnableSpringDataWebSupport
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass({ PageableHandlerMethodArgumentResolver.class,
WebMvcConfigurerAdapter.class })
WebMvcConfigurer.class })
@ConditionalOnMissingBean(PageableHandlerMethodArgumentResolver.class)
@AutoConfigureAfter(RepositoryRestMvcAutoConfiguration.class)
public class SpringDataWebAutoConfiguration {

@ -33,7 +33,7 @@ import org.springframework.mobile.device.DeviceResolver;
import org.springframework.mobile.device.DeviceResolverHandlerInterceptor;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Mobile's
@ -62,7 +62,7 @@ public class DeviceResolverAutoConfiguration {
@Configuration
@Order(0)
protected static class DeviceResolverMvcConfiguration
extends WebMvcConfigurerAdapter {
implements WebMvcConfigurer {
private DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor;

@ -33,7 +33,7 @@ import org.springframework.mobile.device.site.SitePreferenceHandlerInterceptor;
import org.springframework.mobile.device.site.SitePreferenceHandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Mobile's
@ -64,7 +64,7 @@ public class SitePreferenceAutoConfiguration {
@Configuration
protected static class SitePreferenceMvcConfiguration
extends WebMvcConfigurerAdapter {
implements WebMvcConfigurer {
private final SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor;

@ -52,7 +52,7 @@ import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.jta.JtaTransactionManager;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Base {@link EnableAutoConfiguration Auto-configuration} for JPA.
@ -197,7 +197,7 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
@Configuration
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(WebMvcConfigurerAdapter.class)
@ConditionalOnClass(WebMvcConfigurer.class)
@ConditionalOnMissingBean({ OpenEntityManagerInViewInterceptor.class,
OpenEntityManagerInViewFilter.class })
@ConditionalOnProperty(prefix = "spring.jpa", name = "open-in-view", havingValue = "true", matchIfMissing = true)
@ -206,7 +206,7 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
// Defined as a nested config to ensure WebMvcConfigurerAdapter is not read when
// not on the classpath
@Configuration
protected static class JpaWebMvcConfiguration extends WebMvcConfigurerAdapter {
protected static class JpaWebMvcConfiguration implements WebMvcConfigurer {
@Bean
public OpenEntityManagerInViewInterceptor openEntityManagerInViewInterceptor() {

@ -30,7 +30,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Security OAuth2.
@ -40,7 +40,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
* @since 1.3.0
*/
@Configuration
@ConditionalOnClass({ OAuth2AccessToken.class, WebMvcConfigurerAdapter.class })
@ConditionalOnClass({ OAuth2AccessToken.class, WebMvcConfigurer.class })
@Import({ OAuth2AuthorizationServerConfiguration.class,
OAuth2MethodSecurityConfiguration.class, OAuth2ResourceServerConfiguration.class,
OAuth2RestOperationsConfiguration.class })

@ -114,7 +114,7 @@ import org.springframework.web.servlet.config.annotation.ResourceChainRegistrati
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;
import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
@ -146,7 +146,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class,
WebMvcConfigurerAdapter.class })
WebMvcConfigurer.class })
@ConditionalOnMissingBean(WebMvcConfigurationSupport.class)
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE + 10)
@AutoConfigureAfter({ DispatcherServletAutoConfiguration.class,
@ -170,15 +170,15 @@ public class WebMvcAutoConfiguration {
return new OrderedHttpPutFormContentFilter();
}
// Defined as a nested config to ensure WebMvcConfigurerAdapter is not read when not
// Defined as a nested config to ensure WebMvcConfigurer is not read when not
// on the classpath
@Configuration
@Import({ EnableWebMvcConfiguration.class, MvcValidatorRegistrar.class })
@EnableConfigurationProperties({ WebMvcProperties.class, ResourceProperties.class })
public static class WebMvcAutoConfigurationAdapter extends WebMvcConfigurerAdapter {
public static class WebMvcAutoConfigurationAdapter implements WebMvcConfigurer {
private static final Log logger = LogFactory
.getLog(WebMvcConfigurerAdapter.class);
.getLog(WebMvcConfigurer.class);
private final ResourceProperties resourceProperties;

@ -78,7 +78,7 @@ import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.handler.HandlerExceptionResolverComposite;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;
@ -834,7 +834,7 @@ public class WebMvcAutoConfigurationTests {
}
@Configuration
protected static class WebJars extends WebMvcConfigurerAdapter {
protected static class WebJars implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
@ -845,7 +845,7 @@ public class WebMvcAutoConfigurationTests {
}
@Configuration
protected static class AllResources extends WebMvcConfigurerAdapter {
protected static class AllResources implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
@ -976,7 +976,7 @@ public class WebMvcAutoConfigurationTests {
}
@Configuration
protected static class ValidatorWebMvcConfigurer extends WebMvcConfigurerAdapter {
protected static class ValidatorWebMvcConfigurer implements WebMvcConfigurer {
@Override
public Validator getValidator() {

@ -33,7 +33,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootConfiguration
@EnableAutoConfiguration
@ -60,7 +60,7 @@ public class SampleAtmosphereApplication {
}
@Configuration
static class MvcConfiguration extends WebMvcConfigurerAdapter {
static class MvcConfiguration implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {

@ -23,13 +23,13 @@ import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
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.springframework.web.servlet.view.InternalResourceViewResolver;
@EnableWebMvc
@ComponentScan
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
public class WebConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {

@ -35,11 +35,11 @@ import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootApplication
@EnableGlobalMethodSecurity(securedEnabled = true)
public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
public class SampleMethodSecurityApplication implements WebMvcConfigurer {
@Controller
protected static class HomeController {

@ -31,11 +31,11 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootApplication
@Controller
public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
public class SampleWebSecureCustomApplication implements WebMvcConfigurer {
@GetMapping("/")
public String home(Map<String, Object> model) {

@ -19,11 +19,11 @@ package sample.web.secure.github;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootApplication
@EnableOAuth2Sso
public class SampleGithubSecureApplication extends WebMvcConfigurerAdapter {
public class SampleGithubSecureApplication implements WebMvcConfigurer {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleGithubSecureApplication.class, args);

@ -34,11 +34,11 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootApplication
@Controller
public class SampleWebSecureJdbcApplication extends WebMvcConfigurerAdapter {
public class SampleWebSecureJdbcApplication implements WebMvcConfigurer {
@GetMapping("/")
public String home(Map<String, Object> model) {

@ -31,11 +31,11 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootApplication
@Controller
public class SampleWebSecureApplication extends WebMvcConfigurerAdapter {
public class SampleWebSecureApplication implements WebMvcConfigurer {
@GetMapping("/")
public String home(Map<String, Object> model) {

@ -30,7 +30,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import static org.assertj.core.api.Assertions.assertThat;
@ -155,7 +155,7 @@ public class WebMvcTypeExcludeFilterTests {
}
static class ExampleWeb extends WebMvcConfigurerAdapter {
static class ExampleWeb implements WebMvcConfigurer {
}

@ -26,7 +26,6 @@ import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* Example {@link WebMvcConfigurer} used in {@link WebMvcTest} tests.
@ -34,7 +33,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
* @author Phillip Webb
*/
@Component
public class ExampleWebMvcConfigurer extends WebMvcConfigurerAdapter {
public class ExampleWebMvcConfigurer implements WebMvcConfigurer {
@Override
public void addArgumentResolvers(

@ -52,7 +52,7 @@ import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import static org.assertj.core.api.Assertions.assertThat;
@ -128,7 +128,7 @@ public class ErrorPageFilterIntegrationTests {
}
@Controller
public static class HelloWorldController extends WebMvcConfigurerAdapter {
public static class HelloWorldController implements WebMvcConfigurer {
private int status;

Loading…
Cancel
Save