甜蜜阿宝771687693吧 关注:3贴子:21
  • 0回复贴,共1

springmvc配置文件

只看楼主收藏回复

spring-mvc.xml配置
<?xml version="1.0" encoding="GBK"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<aop:aspectj-autoproxy proxy-target-class="true" />
<!-- 自动扫描包,用于自动注入 -->
<context:component-scan base-package="com.badidu.springmvc" />
<!-- mvc驱动注入 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="cacheSeconds" value="0" />
<property name="messageConverters">
<util:list id="beanList">
<ref bean="stringHttpMessageConverter" />
<ref bean="byteArrayHttpMessageConverter" />
<ref bean="resourceHttpMessageConverter" />
<ref bean="sourceHttpMessageConverter" />
<ref bean="xmlAwareFormHttpMessageConverter" />
</util:list>
</property>
</bean>
<bean id="stringHttpMessageConverter" class="org.springframework.http.converter.StringHttpMessageConverter"/>
<bean id="byteArrayHttpMessageConverter" class="org.springframework.http.converter.ByteArrayHttpMessageConverter" />
<bean id="resourceHttpMessageConverter" class="org.springframework.http.converter.ResourceHttpMessageConverter" />
<bean id="sourceHttpMessageConverter" class="org.springframework.http.converter.xml.SourceHttpMessageConverter" />
<bean id="xmlAwareFormHttpMessageConverter" class="org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter" />
<mvc:resources mapping="/static/script/**" location="/script/" />
<mvc:resources mapping="/static/style/**" location="/style/" />
<mvc:resources mapping="/static/image/**" location="/image/" />
<mvc:resources mapping="/static/validator/**" location="/validator/" />
<mvc:resources mapping="/static/component/**" location="/component/" />
<mvc:resources mapping="/static/upload/**" location="/upload/" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp" />
</bean>
</beans>


IP属地:陕西1楼2014-07-09 20:59回复