SpringMVC环境搭建 配置文件_2
applicationContext
命名空间:
引入命名空间,这样可以在代码中使用annotation
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:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- 引入注解 -->
<context:annotation-config/>
<!-- 注册并将bean交给IOC容器控制,但是不注册controller类-->
<context:component-scan base-package:"com.wtw.*">
<context:exclude-filter: type:"annotation" expression="org.springframework.stereotype.Controller"
</context:compnent-scan>
<!-- 导入数据库连接配置文件-->
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 数据库连接池-->
<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destory-method="close">
<property name="driverClassName" value="${driverClass}"/>
<property name="url" value="${jdbcurl}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</bean>
<!-- 配置jdbcTemplate -->
<bean name="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 采用注解的方式配置事务-->
<bean name="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
SpringMVC环境搭建 配置文件_2的更多相关文章
- SpringMvc环境搭建(配置文件)
在上面的随笔里已经把搭建springmvc环境的基本需要的包都下下来了,拉下来就是写配置文件了. 下面左图是总的结构,右图是增加包 一.最开始当然是web.xml文件了,这是一个总的宏观配置 < ...
- SpringMVC环境搭建 配置文件_3
springmvc-servlet.xml 引入命名空间,引入注解 命名空间: xmlns="http://www.springframework.org/schema/beans" ...
- SpringMVC环境搭建和详解
1.Spring容器和SpringMVC容器是父子容器 1.1 SpringMVC容器可以调用Spring容器中的所有内容 1.2 图示 2.SpringMVC环境搭建 1.导入jar包 2.在web ...
- springmvc环境搭建及实例
一. 软件环境 eclipse-jee-mars-R-win32-x86_64 jdk1.7.0_79 apache-tomcat-7.0.52 spring-framework-3.2.0.RELE ...
- springmvc环境搭建以及常见问题解决
1.新建maven工程 a) 打开eclipse,file->new->project->Maven->Maven Project b) 下一步 c) 选择创建的工程为 ...
- spring入门(五)【springMVC环境搭建】
springMVC作为spring的一个WEB组件,是一个MVC的思想,减少了WEB开发的难度,现介绍springMVC环境的搭建,具体的原理放在后面介绍.用过框架的朋友都知道要在WEB项目中使用一个 ...
- SpringMVC 环境搭建
SpringMVC 框架环境搭建操作步骤如下: 创建动态 Web 项目 配置 Tomcat 服务器 配置 SpringMVC 前端控制器 <?xml version="1.0" ...
- SpringMVC工作环境搭建 配置文件
web.xml配置 在服务器端容器启动之前加载配置文件的顺序:context-param>listener>filter>servlet //容器配置application上下文的时 ...
- SpringMVC环境搭建
Spring MVC为展现层提供的基于MVC设计理念的优秀Web框架,是目前最主流的MVC框架之一. Spring 3.0之后完全超越Struts2,称为最优秀的MVC框架.学完SpringMVC之后 ...
随机推荐
- 记账类APP竞品分析-挖财与随手记
注:本文更新中. 一.概览 1. 产品名称及版本 l 挖财11.2.0.0 免费版(2016/9/6发布) l 随手记10.2.8免费版(2016/8/22发布) 2. 设备信息 设备型号:i ...
- ActiveMQ的初夜
Producer Flow Control mq自己实现了Flow Control(流量控制,默认开启),在mq的版本中,4.x和5.x流量控制实现原理并不相同,前者通过 TCP Flow Contr ...
- 工作记事 unknownHost
使用xutils框架 下带图片(文件)事解析时在urlconnection 执行connect操作的时候抛出 UnknownHostException 而浏览器中能够正常访问该地址.这是由于该u ...
- 第六章第一个linux个程序:统计单词个数
第六章第一个linux个程序:统计单词个数 从本章就开始激动人心的时刻——实战,去慢慢揭开linux神秘的面纱.本章的实例是统计一片文章或者一段文字中的单词个数. 第 1 步:建立 Linu x 驱 ...
- Python2.7.12开发环境构建(自动补全)
一.安装readline-devel包 Python的编译安装依赖于这个包 yum -y install readline-devel 二.安装Python2.7.12 Python官方网站(到此处下 ...
- [Note] Build your SDL2 Environment in Visual Studio 2013 配置你的SDL2运行环境
Right key your project in "solution manager(解决方案资源管理器)", choose the "Property(属性)&quo ...
- JQ轮播
首先是html结构,一个简单的轮播,主要分为三大层:div>ul>li,li里面的img图片. 其次,css样式:div固定住宽高,overflow:hidden:ul的宽度建议是动态获取 ...
- logrotate机制与原理[转载]
http://blog.lightxue.com/how-logrotate-works/ 日志实在是太有用了,它记录了程序运行时各种信息.通过日志可以分析用户行为,记录运行轨迹,查找程序问题.可惜磁 ...
- PHP+Mysql+jQuery实现地图区域数据统计-展示数据
我们要在地图上有限的区块内展示更多的信息,更好的办法是通过地图交互来实现.本文将给大家讲解通过鼠标滑动到地图指定省份区域,在弹出的提示框中显示对应省份的数据信息.适用于数据统计和地图区块展示等场景. ...
- Gridview 分多页时导出excel的解决方案
在开发会遇到将gridview中的数据导入到excel 这样的需求,当girdview有多页数据时按照一般的方式导出的数据只可能是当前页的数据,后几页的数据还在数据库内,没有呈现到页面上,传统的方式是 ...