xml配置RequestMappingHandlerAdapter
时间: 2024-01-19 20:17:45 浏览: 46
RequestMappingHandlerAdapter可以通过XML配置进行配置。以下是一个示例配置:
```xml
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/plain;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
<!-- 其他自定义的消息转换器 -->
</list>
</property>
<property name="argumentResolvers">
<list>
<!-- 自定义的方法参数解析器 -->
</list>
</property>
<property name="returnValueHandlers">
<list>
<!-- 自定义的返回值处理器 -->
</list>
</property>
<property name="interceptors">
<list>
<!-- 自定义的拦截器 -->
</list>
</property>
</bean>
```
在上述配置中,可以通过`messageConverters`属性配置消息转换器,通过`argumentResolvers`属性配置方法参数解析器,通过`returnValueHandlers`属性配置返回值处理器,通过`interceptors`属性配置拦截器。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)