GeezerVison is showing github.com — 扩展XML请求和响应的支持 · fullsing/SpringBoot-Learning@1c78b86
File tree
Expand file treeCollapse file tree
Open diff view settings
Chapter3-1-8/src/main/java/com/didispace
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: Chapter3-1-8/src/main/java/com/didispace/Application.java +3-22Lines changed: 3 additions & 22 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
2 | 2 |
|
3 | 3 | import org.springframework.boot.SpringApplication; |
4 | 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
5 | | -import org.springframework.context.annotation.Configuration; |
6 | | -import org.springframework.http.converter.HttpMessageConverter; |
7 | | -import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; |
8 | | -import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter; |
9 | | -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
10 | | - |
11 | | -import java.util.List; |
12 | 5 |
|
13 | 6 | /** |
14 | | - * |
15 | 7 | * @author 程序猿DD |
16 | 8 | * @version 1.0.0 |
17 | 9 | * @blog http://blog.didispace.com |
18 | | - * |
19 | 10 | */ |
20 | 11 | @SpringBootApplication |
21 | 12 | public class Application { |
22 | 13 |
|
23 | | - public static void main(String[] args) { |
24 | | - SpringApplication.run(Application.class, args); |
25 | | - } |
26 | | - |
27 | | - @Configuration |
28 | | - class MessageConverterConfig extends WebMvcConfigurerAdapter { |
29 | | - @Override |
30 | | - public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
31 | | - Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.xml(); |
32 | | - builder.indentOutput(true); |
33 | | - converters.add(new MappingJackson2XmlHttpMessageConverter(builder.build())); |
34 | | - } |
35 | | - } |
| 14 | + public static void main(String[] args) { |
| 15 | + SpringApplication.run(Application.class, args); |
| 16 | + } |
36 | 17 |
|
37 | 18 | } |