|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -33,7 +33,6 @@ import org.springframework.context.annotation.Import;
@@ -33,7 +33,6 @@ import org.springframework.context.annotation.Import;
|
|
|
|
|
* @EnableWebMvc |
|
|
|
|
* @ComponentScan(basePackageClasses = MyConfiguration.class) |
|
|
|
|
* public class MyConfiguration { |
|
|
|
|
* |
|
|
|
|
* } |
|
|
|
|
* </pre> |
|
|
|
|
* |
|
|
|
|
@ -46,15 +45,15 @@ import org.springframework.context.annotation.Import;
@@ -46,15 +45,15 @@ import org.springframework.context.annotation.Import;
|
|
|
|
|
* @ComponentScan(basePackageClasses = MyConfiguration.class) |
|
|
|
|
* public class MyConfiguration implements WebMvcConfigurer { |
|
|
|
|
* |
|
|
|
|
* @Override |
|
|
|
|
* public void addFormatters(FormatterRegistry formatterRegistry) { |
|
|
|
|
* @Override |
|
|
|
|
* public void addFormatters(FormatterRegistry formatterRegistry) { |
|
|
|
|
* formatterRegistry.addConverter(new MyConverter()); |
|
|
|
|
* } |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* @Override |
|
|
|
|
* public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
|
|
|
|
* @Override |
|
|
|
|
* public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
|
|
|
|
* converters.add(new MyHttpMessageConverter()); |
|
|
|
|
* } |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* } |
|
|
|
|
* </pre> |
|
|
|
|
@ -66,7 +65,7 @@ import org.springframework.context.annotation.Import;
@@ -66,7 +65,7 @@ import org.springframework.context.annotation.Import;
|
|
|
|
|
* configuration. |
|
|
|
|
* |
|
|
|
|
* <p>If {@link WebMvcConfigurer} does not expose some more advanced setting that |
|
|
|
|
* needs to be configured consider removing the {@code @EnableWebMvc} |
|
|
|
|
* needs to be configured, consider removing the {@code @EnableWebMvc} |
|
|
|
|
* annotation and extending directly from {@link WebMvcConfigurationSupport} |
|
|
|
|
* or {@link DelegatingWebMvcConfiguration}, e.g.: |
|
|
|
|
* |
|
|
|
|
@ -75,16 +74,16 @@ import org.springframework.context.annotation.Import;
@@ -75,16 +74,16 @@ import org.springframework.context.annotation.Import;
|
|
|
|
|
* @ComponentScan(basePackageClasses = { MyConfiguration.class }) |
|
|
|
|
* public class MyConfiguration extends WebMvcConfigurationSupport { |
|
|
|
|
* |
|
|
|
|
* @Override |
|
|
|
|
* public void addFormatters(FormatterRegistry formatterRegistry) { |
|
|
|
|
* @Override |
|
|
|
|
* public void addFormatters(FormatterRegistry formatterRegistry) { |
|
|
|
|
* formatterRegistry.addConverter(new MyConverter()); |
|
|
|
|
* } |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* @Bean |
|
|
|
|
* public RequestMappingHandlerAdapter requestMappingHandlerAdapter() { |
|
|
|
|
* @Bean |
|
|
|
|
* public RequestMappingHandlerAdapter requestMappingHandlerAdapter() { |
|
|
|
|
* // Create or delegate to "super" to create and
|
|
|
|
|
* // customize properties of RequestMappingHandlerAdapter
|
|
|
|
|
* } |
|
|
|
|
* } |
|
|
|
|
* } |
|
|
|
|
* </pre> |
|
|
|
|
* |
|
|
|
|
|