<?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:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<context:component-scan
base-package="com.tarena"/>
<mvc:annotation-driven/>
<!-- 拦截器配置 -->
<mvc:interceptors>
<!-- <mvc:interceptor>
<mvc:mapping path="/**" />
<bean
class="com.tarena.web.DemoInterceptor" />
</mvc:interceptor> -->
<!-- 授权拦截器: 任何请求都拦截, 除了/login路径
以下的请求不拦截
/demo/hello.form 请求被拦截, 如果: 当前会话中
已经有登录用户信息(用户已经登录) 拦截会允许继续
访问, 否则没有登录信息, 拦截或转发到 登录页面
-->
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/login/**"/>
<mvc:exclude-mapping path="/login2/**"/>
<bean
class="com.tarena.web.AccessIntercept"/>
</mvc:interceptor>
</mvc:interceptors>
<bean id="handlerMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings" ref="mappings"/>
</bean>
<util:properties id="mappings" >
<prop key="/hello.form">
helloController
</prop>
</util:properties>
<!-- 视图处理器 -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix"
value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
<util:properties id="jdbcProps"
location="classpath:jdbc.properties"/>
<bean id="expHandler"
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<!-- setExceptionMappings(Properties map) -->
<property name="exceptionMappings">
<props>
<!-- 如果出现空指针异常, 转发到
error.jsp -->
<prop key="java.lang.NullPointerException">
error
</prop>
</props>
</property>
</bean>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize"
value="102400"/>
</bean>
<bean id="dbcpDataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="#{jdbcProps.driver}"/>
<property name="url"
value="#{jdbcProps.url}"/>
<property name="username"
value="#{jdbcProps.user}"/>
<property name="password"
value="#{jdbcProps.pwd}"/>
<property name="initialSize"
value="#{jdbcProps.init}"/>
<property name="maxActive"
value="#{jdbcProps.max}"/>
<property name="maxIdle"
value="#{jdbcProps.min}"/>
</bean>
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<!-- jdbcTemplate上有setDataSource()方法
setDataSource(DataSource d) 接口类型参数
可以注入任何DataSource 实现类即可 -->
<property name="dataSource"
ref="dbcpDataSource"/>
<!-- 可以更换 c3p0 作为dataSource -->
</bean>
</beans>
Spring框架需要的jar包完整版
需积分: 16 41 浏览量
2014-12-11
16:06:10
上传
评论
收藏 7.71MB ZIP 举报
Bingo3313
- 粉丝: 0
- 资源: 2
最新资源
- 筷手引流工具.apk
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈