001/* 002 * Copyright 2002-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.web.servlet.config.annotation; 018 019import java.util.List; 020 021import org.springframework.format.FormatterRegistry; 022import org.springframework.http.converter.HttpMessageConverter; 023import org.springframework.validation.MessageCodesResolver; 024import org.springframework.validation.Validator; 025import org.springframework.web.method.support.HandlerMethodArgumentResolver; 026import org.springframework.web.method.support.HandlerMethodReturnValueHandler; 027import org.springframework.web.servlet.HandlerExceptionResolver; 028 029/** 030 * An implementation of {@link WebMvcConfigurer} with empty methods allowing 031 * subclasses to override only the methods they're interested in. 032 * 033 * @author Rossen Stoyanchev 034 * @since 3.1 035 */ 036public abstract class WebMvcConfigurerAdapter implements WebMvcConfigurer { 037 038 /** 039 * {@inheritDoc} 040 * <p>This implementation is empty. 041 */ 042 @Override 043 public void configurePathMatch(PathMatchConfigurer configurer) { 044 } 045 046 /** 047 * {@inheritDoc} 048 * <p>This implementation is empty. 049 */ 050 @Override 051 public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { 052 } 053 054 /** 055 * {@inheritDoc} 056 * <p>This implementation is empty. 057 */ 058 @Override 059 public void configureAsyncSupport(AsyncSupportConfigurer configurer) { 060 } 061 062 /** 063 * {@inheritDoc} 064 * <p>This implementation is empty. 065 */ 066 @Override 067 public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { 068 } 069 070 /** 071 * {@inheritDoc} 072 * <p>This implementation is empty. 073 */ 074 @Override 075 public void addFormatters(FormatterRegistry registry) { 076 } 077 078 /** 079 * {@inheritDoc} 080 * <p>This implementation is empty. 081 */ 082 @Override 083 public void addInterceptors(InterceptorRegistry registry) { 084 } 085 086 /** 087 * {@inheritDoc} 088 * <p>This implementation is empty. 089 */ 090 @Override 091 public void addResourceHandlers(ResourceHandlerRegistry registry) { 092 } 093 094 /** 095 * {@inheritDoc} 096 * <p>This implementation is empty. 097 */ 098 @Override 099 public void addCorsMappings(CorsRegistry registry) { 100 } 101 102 /** 103 * {@inheritDoc} 104 * <p>This implementation is empty. 105 */ 106 @Override 107 public void addViewControllers(ViewControllerRegistry registry) { 108 } 109 110 /** 111 * {@inheritDoc} 112 * <p>This implementation is empty. 113 */ 114 @Override 115 public void configureViewResolvers(ViewResolverRegistry registry) { 116 } 117 118 /** 119 * {@inheritDoc} 120 * <p>This implementation is empty. 121 */ 122 @Override 123 public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { 124 } 125 126 /** 127 * {@inheritDoc} 128 * <p>This implementation is empty. 129 */ 130 @Override 131 public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) { 132 } 133 134 /** 135 * {@inheritDoc} 136 * <p>This implementation is empty. 137 */ 138 @Override 139 public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { 140 } 141 142 /** 143 * {@inheritDoc} 144 * <p>This implementation is empty. 145 */ 146 @Override 147 public void extendMessageConverters(List<HttpMessageConverter<?>> converters) { 148 } 149 150 /** 151 * {@inheritDoc} 152 * <p>This implementation is empty. 153 */ 154 @Override 155 public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { 156 } 157 158 /** 159 * {@inheritDoc} 160 * <p>This implementation is empty. 161 */ 162 @Override 163 public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { 164 } 165 166 /** 167 * {@inheritDoc} 168 * <p>This implementation returns {@code null}. 169 */ 170 @Override 171 public Validator getValidator() { 172 return null; 173 } 174 175 /** 176 * {@inheritDoc} 177 * <p>This implementation returns {@code null}. 178 */ 179 @Override 180 public MessageCodesResolver getMessageCodesResolver() { 181 return null; 182 } 183 184}