46
46
*/
47
47
public interface WebMvcConfigurer {
48
48
49
- /**
50
- * Add {@link Converter}s and {@link Formatter}s in addition to the ones
51
- * registered by default.
52
- */
53
- void addFormatters (FormatterRegistry registry );
54
-
55
- /**
56
- * Configure the {@link HttpMessageConverter}s to use for reading or writing
57
- * to the body of the request or response. If no converters are added, a
58
- * default list of converters is registered.
59
- * <p><strong>Note</strong> that adding converters to the list, turns off
60
- * default converter registration. To simply add a converter without impacting
61
- * default registration, consider using the method
62
- * {@link #extendMessageConverters(java.util.List)} instead.
63
- * @param converters initially an empty list of converters
64
- */
65
- void configureMessageConverters (List <HttpMessageConverter <?>> converters );
66
-
67
- /**
68
- * A hook for extending or modifying the list of converters after it has been
69
- * configured. This may be useful for example to allow default converters to
70
- * be registered and then insert a custom converter through this method.
71
- * @param converters the list of configured converters to extend.
72
- * @since 4.1.3
73
- */
74
- void extendMessageConverters (List <HttpMessageConverter <?>> converters );
75
-
76
- /**
77
- * Provide a custom {@link Validator} instead of the one created by default.
78
- * The default implementation, assuming JSR-303 is on the classpath, is:
79
- * {@link org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean}.
80
- * Leave the return value as {@code null} to keep the default.
81
- */
82
- Validator getValidator ();
83
-
84
- /**
85
- * Configure content negotiation options.
86
- */
87
- void configureContentNegotiation (ContentNegotiationConfigurer configurer );
88
-
89
- /**
90
- * Configure asynchronous request handling options.
91
- */
92
- void configureAsyncSupport (AsyncSupportConfigurer configurer );
93
-
94
49
/**
95
50
* Helps with configuring HandlerMappings path matching options such as trailing slash match,
96
51
* suffix registration, path matcher and path helper.
@@ -105,40 +60,28 @@ public interface WebMvcConfigurer {
105
60
void configurePathMatch (PathMatchConfigurer configurer );
106
61
107
62
/**
108
- * Add resolvers to support custom controller method argument types.
109
- * <p>This does not override the built-in support for resolving handler
110
- * method arguments. To customize the built-in support for argument
111
- * resolution, configure {@link RequestMappingHandlerAdapter} directly.
112
- * @param argumentResolvers initially an empty list
63
+ * Configure content negotiation options.
113
64
*/
114
- void addArgumentResolvers ( List < HandlerMethodArgumentResolver > argumentResolvers );
65
+ void configureContentNegotiation ( ContentNegotiationConfigurer configurer );
115
66
116
67
/**
117
- * Add handlers to support custom controller method return value types.
118
- * <p>Using this option does not override the built-in support for handling
119
- * return values. To customize the built-in support for handling return
120
- * values, configure RequestMappingHandlerAdapter directly.
121
- * @param returnValueHandlers initially an empty list
68
+ * Configure asynchronous request handling options.
122
69
*/
123
- void addReturnValueHandlers ( List < HandlerMethodReturnValueHandler > returnValueHandlers );
70
+ void configureAsyncSupport ( AsyncSupportConfigurer configurer );
124
71
125
72
/**
126
- * Configure the {@link HandlerExceptionResolver}s to handle unresolved
127
- * controller exceptions. If no resolvers are added to the list, default
128
- * exception resolvers are added instead.
129
- * @param exceptionResolvers initially an empty list
73
+ * Configure a handler to delegate unhandled requests by forwarding to the
74
+ * Servlet container's "default" servlet. A common use case for this is when
75
+ * the {@link DispatcherServlet} is mapped to "/" thus overriding the
76
+ * Servlet container's default handling of static resources.
130
77
*/
131
- void configureHandlerExceptionResolvers ( List < HandlerExceptionResolver > exceptionResolvers );
78
+ void configureDefaultServletHandling ( DefaultServletHandlerConfigurer configurer );
132
79
133
80
/**
134
- * A hook for extending or modifying the list of
135
- * {@link HandlerExceptionResolver}s after it has been configured. This may
136
- * be useful for example to allow default resolvers to be registered and then
137
- * insert a custom one through this method.
138
- * @param exceptionResolvers the list of configured resolvers to extend.
139
- * @since 4.3
81
+ * Add {@link Converter}s and {@link Formatter}s in addition to the ones
82
+ * registered by default.
140
83
*/
141
- void extendHandlerExceptionResolvers ( List < HandlerExceptionResolver > exceptionResolvers );
84
+ void addFormatters ( FormatterRegistry registry );
142
85
143
86
/**
144
87
* Add Spring MVC lifecycle interceptors for pre- and post-processing of
@@ -155,11 +98,17 @@ public interface WebMvcConfigurer {
155
98
void addInterceptors (InterceptorRegistry registry );
156
99
157
100
/**
158
- * Provide a custom {@link MessageCodesResolver} for building message codes
159
- * from data binding and validation error codes. Leave the return value as
160
- * {@code null} to keep the default .
101
+ * Add handlers to serve static resources such as images, js, and, css
102
+ * files from specific locations under web application root, the classpath,
103
+ * and others .
161
104
*/
162
- MessageCodesResolver getMessageCodesResolver ();
105
+ void addResourceHandlers (ResourceHandlerRegistry registry );
106
+
107
+ /**
108
+ * Configure cross origin requests processing.
109
+ * @since 4.2
110
+ */
111
+ void addCorsMappings (CorsRegistry registry );
163
112
164
113
/**
165
114
* Configure simple automated controllers pre-configured with the response
@@ -178,24 +127,74 @@ public interface WebMvcConfigurer {
178
127
void configureViewResolvers (ViewResolverRegistry registry );
179
128
180
129
/**
181
- * Add handlers to serve static resources such as images, js, and, css
182
- * files from specific locations under web application root, the classpath,
183
- * and others.
130
+ * Add resolvers to support custom controller method argument types.
131
+ * <p>This does not override the built-in support for resolving handler
132
+ * method arguments. To customize the built-in support for argument
133
+ * resolution, configure {@link RequestMappingHandlerAdapter} directly.
134
+ * @param argumentResolvers initially an empty list
184
135
*/
185
- void addResourceHandlers ( ResourceHandlerRegistry registry );
136
+ void addArgumentResolvers ( List < HandlerMethodArgumentResolver > argumentResolvers );
186
137
187
138
/**
188
- * Configure a handler to delegate unhandled requests by forwarding to the
189
- * Servlet container's "default" servlet. A common use case for this is when
190
- * the {@link DispatcherServlet} is mapped to "/" thus overriding the
191
- * Servlet container's default handling of static resources.
139
+ * Add handlers to support custom controller method return value types.
140
+ * <p>Using this option does not override the built-in support for handling
141
+ * return values. To customize the built-in support for handling return
142
+ * values, configure RequestMappingHandlerAdapter directly.
143
+ * @param returnValueHandlers initially an empty list
192
144
*/
193
- void configureDefaultServletHandling ( DefaultServletHandlerConfigurer configurer );
145
+ void addReturnValueHandlers ( List < HandlerMethodReturnValueHandler > returnValueHandlers );
194
146
195
147
/**
196
- * Configure cross origin requests processing.
197
- * @since 4.2
148
+ * Configure the {@link HttpMessageConverter}s to use for reading or writing
149
+ * to the body of the request or response. If no converters are added, a
150
+ * default list of converters is registered.
151
+ * <p><strong>Note</strong> that adding converters to the list, turns off
152
+ * default converter registration. To simply add a converter without impacting
153
+ * default registration, consider using the method
154
+ * {@link #extendMessageConverters(java.util.List)} instead.
155
+ * @param converters initially an empty list of converters
198
156
*/
199
- void addCorsMappings (CorsRegistry registry );
157
+ void configureMessageConverters (List <HttpMessageConverter <?>> converters );
158
+
159
+ /**
160
+ * A hook for extending or modifying the list of converters after it has been
161
+ * configured. This may be useful for example to allow default converters to
162
+ * be registered and then insert a custom converter through this method.
163
+ * @param converters the list of configured converters to extend.
164
+ * @since 4.1.3
165
+ */
166
+ void extendMessageConverters (List <HttpMessageConverter <?>> converters );
167
+
168
+ /**
169
+ * Configure the {@link HandlerExceptionResolver}s to handle unresolved
170
+ * controller exceptions. If no resolvers are added to the list, default
171
+ * exception resolvers are added instead.
172
+ * @param exceptionResolvers initially an empty list
173
+ */
174
+ void configureHandlerExceptionResolvers (List <HandlerExceptionResolver > exceptionResolvers );
175
+
176
+ /**
177
+ * A hook for extending or modifying the list of {@link HandlerExceptionResolver}s
178
+ * after it has been configured. This may be useful for example to allow default
179
+ * resolvers to be registered and then insert a custom one through this method.
180
+ * @param exceptionResolvers the list of configured resolvers to extend
181
+ * @since 4.3
182
+ */
183
+ void extendHandlerExceptionResolvers (List <HandlerExceptionResolver > exceptionResolvers );
184
+
185
+ /**
186
+ * Provide a custom {@link Validator} instead of the one created by default.
187
+ * The default implementation, assuming JSR-303 is on the classpath, is:
188
+ * {@link org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean}.
189
+ * Leave the return value as {@code null} to keep the default.
190
+ */
191
+ Validator getValidator ();
192
+
193
+ /**
194
+ * Provide a custom {@link MessageCodesResolver} for building message codes
195
+ * from data binding and validation error codes. Leave the return value as
196
+ * {@code null} to keep the default.
197
+ */
198
+ MessageCodesResolver getMessageCodesResolver ();
200
199
201
200
}
0 commit comments