在Spring中这是一个很简洁的标签。它是对两个bean的简写。
在3.0中是 DefaultAnnotationHandlerMapping 和 AnnotationMethodHandlerAdapter ,从3.1开始改成了 RequestMappingHandlerMapping 和 RequestMappingHandlerAdapter
其中,Adapter中注入了一个MessageConverter列表,该列表中又注入了几个经常用到的格式转换,比如XmlHttpMessageConverter/JsonHttpMessageConverter等,详见下面贴来的Spring 3.0.X:
1 <!-- 注解请求映射 --> 2 <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> 3 <property name="interceptors"> 4 <list> 5 <ref bean="logNDCInteceptor"/> <!-- 日志拦截器,这是你自定义的拦截器 --> 6 </list> 7 </property> 8 </bean> 9 <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> 10 <property name="messageConverters"> 11 <list> 12 <ref bean="byteArray_hmc" /> 13 <ref bean="string_hmc" /> 14 <ref bean="resource_hmc" /> 15 <ref bean="source_hmc" /> 16 <ref bean="xmlAwareForm_hmc" /> 17 <ref bean="jaxb2RootElement_hmc" /> 18 <ref bean="jackson_hmc" /> 19 </list> 20 </property> 21 </bean> 22 <bean id="byteArray_hmc" class="org.springframework.http.converter.ByteArrayHttpMessageConverter" /><!-- 处理.. --> 23 <bean id="string_hmc" class="org.springframework.http.converter.StringHttpMessageConverter" /><!-- 处理.. --> 24 <bean id="resource_hmc" class="org.springframework.http.converter.ResourceHttpMessageConverter" /><!-- 处理.. --> 25 <bean id="source_hmc" class="org.springframework.http.converter.xml.SourceHttpMessageConverter" /><!-- 处理.. --> 26 <bean id="xmlAwareForm_hmc" class="org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter" /><!-- 处理.. --> 27 <bean id="jaxb2RootElement_hmc" class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter" /><!-- 处理.. --> 28 <bean id="jackson_hmc" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /><!-- 处理json-->