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的更多相关文章

  1. SpringMvc环境搭建(配置文件)

    在上面的随笔里已经把搭建springmvc环境的基本需要的包都下下来了,拉下来就是写配置文件了. 下面左图是总的结构,右图是增加包 一.最开始当然是web.xml文件了,这是一个总的宏观配置 < ...

  2. SpringMVC环境搭建 配置文件_3

    springmvc-servlet.xml 引入命名空间,引入注解 命名空间: xmlns="http://www.springframework.org/schema/beans" ...

  3. SpringMVC环境搭建和详解

    1.Spring容器和SpringMVC容器是父子容器 1.1 SpringMVC容器可以调用Spring容器中的所有内容 1.2 图示 2.SpringMVC环境搭建 1.导入jar包 2.在web ...

  4. springmvc环境搭建及实例

    一. 软件环境 eclipse-jee-mars-R-win32-x86_64 jdk1.7.0_79 apache-tomcat-7.0.52 spring-framework-3.2.0.RELE ...

  5. springmvc环境搭建以及常见问题解决

    1.新建maven工程 a)  打开eclipse,file->new->project->Maven->Maven Project b)  下一步 c)   选择创建的工程为 ...

  6. spring入门(五)【springMVC环境搭建】

    springMVC作为spring的一个WEB组件,是一个MVC的思想,减少了WEB开发的难度,现介绍springMVC环境的搭建,具体的原理放在后面介绍.用过框架的朋友都知道要在WEB项目中使用一个 ...

  7. SpringMVC 环境搭建

    SpringMVC 框架环境搭建操作步骤如下: 创建动态 Web 项目 配置 Tomcat 服务器 配置 SpringMVC 前端控制器 <?xml version="1.0" ...

  8. SpringMVC工作环境搭建 配置文件

    web.xml配置 在服务器端容器启动之前加载配置文件的顺序:context-param>listener>filter>servlet //容器配置application上下文的时 ...

  9. SpringMVC环境搭建

    Spring MVC为展现层提供的基于MVC设计理念的优秀Web框架,是目前最主流的MVC框架之一. Spring 3.0之后完全超越Struts2,称为最优秀的MVC框架.学完SpringMVC之后 ...

随机推荐

  1. Lua table库整理(v5.1)

    这个库提供了表处理的通用函数. 所有函数都放在表 table. 无论何时,若一个操作需要取表的长度, 这张表必须是一个真序列. table.concat(list, [, sep, [, i , [, ...

  2. 分布式事务(一)两阶段提交及JTA

    原创文章,同步发自作者个人博客 http://www.jasongj.com/big_data/two_phase_commit/ 分布式事务 分布式事务简介 分布式事务是指会涉及到操作多个数据库(或 ...

  3. "错误消息 401.2。: 未经授权: 服务器配置导致登录失败。"的解决办法

    [详细报错如下]: “/”应用程序中的服务器错误. 访问被拒绝. 说明: 访问服务此请求所需的资源时出错.服务器可能未配置为访问所请求的 URL. 错误消息 401.2.: 未经授权: 服务器配置导致 ...

  4. ng-class的用法

    最近在学习angular框架,ng-class是angular框架的一个指令,这里是ng-class指令的官方解释: ng-class 指令用于给 HTML 元素动态绑定一个或多个 CSS 类. ng ...

  5. delegate和protocol

    协议和代理对于一个新手来说确实不讨好理解,也有很多的iOS开发的老手对此是懂非懂的.网上的很多博文只是讲了怎么使用,并没有说的很明白.下面我谈一下我的理解. 1.你要先搞明白,协议和代理为什么会出现, ...

  6. 向内存0:200~0:23f依次传送数据0~3fh

    只能用字节为单位传送了. assume cs:sad sad segment start: mov ax, 20h mov ds, ax mov cx, 40h s: mov [bx], bl inc ...

  7. C++的深拷贝与浅拷贝

    对于普通类型的对象来说,它们之间的复制是很简单的,例如:int a=88;int b=a; 而类对象与普通对象不同,类对象内部结构一般较为复杂,存在各种成员变量.下面是一个类对象拷贝的简单例子. #i ...

  8. 无法识别的配置节 connectionStrings

    那啥,asp.net不支持connectionStrings.把IIS中的版本换成2.0或以上就OK了.

  9. UVa 221城市正视图(离散化)

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  10. 《Matrix Computation 3rd》读书笔记——第4章 特殊线性系统