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:jdbc="http://www.springframework.org/schema/jdbc"  
	xmlns:jee="http://www.springframework.org/schema/jee" 
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop" 
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:jpa="http://www.springframework.org/schema/data/jpa"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
		http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
		
		<!-- 组件扫描 -->
		<context:component-scan base-package="cn.tedu.spring"></context:component-scan>
		<!-- 模板解析器:ServletContextTemplateResolver   html文件应该放在WEB-INF下 -->
		<!-- 模板解析器:ClassLoaderTemplateResolver  html文件应该放在resources下-->
		<bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
			<property name="prefix" value="/WEB-INF/templates/"></property>
			<property name="suffix" value=".html"></property>
			<property name="characterEncoding" value="utf-8"></property>
			<property name="templateMode" value="HTML"></property>
			<property name="cacheable" value="false"></property>
		</bean>
		<!-- Spring模板引擎:SpringTemplateEngine -->
		<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
			<property name="templateResolver" ref="templateResolver"></property>
		</bean>
		<!-- 视图解析器:ThymeleafViewResolver -->
		<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
			<property name="templateEngine" ref="templateEngine"></property>
			<property name="characterEncoding" value="utf-8"></property>
		</bean>
		<!-- 配置拦截器 -->
		<mvc:interceptors>
			<mvc:interceptor>
				<!-- 拦截路径 -->  
				
				<mvc:mapping path="/user/success.do"/>
				<bean class="cn.tedu.spring.LoginInterceptor"></bean>
			</mvc:interceptor>
		</mvc:interceptors>
</beans>











**

猜你喜欢

转载自blog.csdn.net/qq_37669050/article/details/102290505