[springMvc]常见配置

2019-11-15 16:06:08来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

[springMvc]常见配置

[springMvc]常见配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	    http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-4.0.xsd
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
        http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop.xsd">
<!-- 配置自动扫描的包 -->		
<context:component-scan base-package="com.booway.mhsy.*"></context:component-scan>
<!-- 配置注解驱动 -->
<mvc:annotation-driven>
<!-- 配置json,支持json解析 -->
<mvc:message-converters register-defaults="true">
				<bean id="fastJacksonMessageConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
					<property name="supportedMediaTypes">
						<list>
							<value>application/json;charset=UTF-8</value>
						</list>
					</property>
					<property name="dateFormat" value="yyyy-MM-dd HH:mm:ss"></property>
				</bean>
			</mvc:message-converters>
</mvc:annotation-driven>
<!-- 配置视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name = "prefix" value="/WEB-INF/"></property>
<property name = "suffix" value = ".jsp"></property>
</bean>
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
		<property name="order" value="1" />
 
		<property name="defaultViews">
			<list>
				<!-- JSON View -->
				<bean
					class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
				</bean>
			</list>
		</property>
	</bean>
</beans>


[springMvc]常见配置  


原文链接:https://www.cnblogs.com/zyfBlogShare/p/11868509.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Springboot中的缓存Cache和CacheManager原理介绍

下一篇:简单看看@RequestBody注解原理