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之后 ...
随机推荐
- Spring 4.x Task 和 Schedule 概述(代java配置)
转载请注明https://zhangzhaoyu.github.io/2016/09/30/spring-task-and-schedule-deep-research/ 摘要 在很多业务场景中,系统 ...
- EF Core CodeFirst实践 ( 使用MS SqlServer)
这里使用 MS SQLSERVER ,网上大多使用 SQLite 先来一个CodeFirst 新建项目 这里我们选择 ASP.NET Core Web Application (.NET Core) ...
- Validform使用ajax详解
demo.config({ showAllError:true, url:"这里指定提交地址", ajaxpost:{ //可以传入$.ajax() ...
- 05_动手动脑之String.equals()方法的实现代码
Question: 请查看String.equals()方法的实现代码,注意学习其实现方法. Answer: java中的String.equals()方法的实现代码: equals()法是根类Obj ...
- 《当心PyCharm里的中文引号陷阱》
用PyCharm照着书敲的一段Python代码,运行起来总报错: "UnicodeEncodeError: 'ascii' codec can't encode character '\u2 ...
- 解决Spine骨骼混合动画错乱问题
Spine是一个很好的制作2D骨骼动画的软件,其中提供的混合(mix)动画功能可以很柔和过度两个不同的动画,但在混合时期,稍有不善,非常容易出现各种错乱.在Spine2D骨骼动画群上,有人提出全K帧. ...
- 关于位图读取函数int Load_Bitmap_File的lseek问题。
事情是这样的,本人在编译3D游戏编程大师技巧中的程序是遇到了一个关于位图读取函数int Load_Bitmap_File的lseek问题. 我使用以下位图读取函数读取位图事报错如下: int Load ...
- 在VS2013中使用Log4net
大致分为3个步骤 引用Log4net
- 1.5 linux笔记
fdisk /dev/sda 查看sda下硬盘状态 fdisk l 看LIST所有文件系统 fdisk n 创建分区 fdisk m help fdisk p 查看所有分区 fdisk w 保存分 ...
- mvc模型验证
自定义的ValidationAttribute类, Compare [Compare("MyOtherProperty")] 两个属性必须相同值,比如我们要求用户重复输入两次邮 ...