【编程技巧】applicationContext.xml 里面可配置bean和数据库地址
<bean id="vendorManagerDao" class="com.active.vendor.dao.VendorManagerDaoImpl">
<property name="dao" ref="dao" />
</bean>
<bean id="vendorManagerService" class="com.active.vendor.service.VendorManagerServiceImpl">
<property name="vendorManagerDao" ref="vendorManagerDao" />
</bean>
<bean id="vendorManagerAction" class="com.active.vendor.action.VendorManagerAction">
<property name="vendorManagerService" ref="vendorManagerService" />
<property name="logService" ref="logService" />
</bean>
<!-- 定义使用C3P0连接池的数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<!-- 指定连接数据库的JDBC驱动 -->
<property name="driverClass">
<value>com.mysql.jdbc.Driver</value>
</property>
<!-- 连接数据库所用的URL -->
<property name="jdbcUrl">
<value>jdbc:mysql://local:3306/activedb?useUnicode=true&characterEncoding=utf8</value>
</property>
<!-- 连接数据库的用户名 -->
<property name="user">
<value>root</value>
</property>
<!-- 连接数据库的密码 -->
<property name="password">
<value>root</value>
</property>
<!-- 设置数据库连接池的最大连接数 -->
<property name="maxPoolSize">
<value>20</value>
</property>
<!-- 设置数据库连接池的最小连接数 -->
<property name="minPoolSize">
<value>2</value>
</property>
<!-- 设置数据库连接池的初始化连接数 -->
<property name="initialPoolSize">
<value>2</value>
</property>
<!-- 设置数据库连接池的连接的最大空闲时间,单位为秒 -->
<property name="maxIdleTime">
<value>20</value>
</property>
</bean>
【编程技巧】applicationContext.xml 里面可配置bean和数据库地址的更多相关文章
- 如果在applicationContext.xml中没有配置bean的属性,那么也会导致空指针异常
报错如下: java.lang.NullPointerException cn.itcast.action.VisitAction.toAddPage(VisitAction.java:37) sun ...
- Spring MVC框架下在java代码中访问applicationContext.xml文件中配置的文件(可以用于读取配置文件内容)
<bean id="propertyConfigurer" class="com.****.framework.core.SpringPropertiesUtil& ...
- 最全三大框架整合(使用映射)——applicationContext.xml里面的配置
applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?> <beans x ...
- Spring 在xml文件中配置Bean
Spring容器是一个大工厂,负责创建.管理所有的Bean. Spring容器支持2种格式的配置文件:xml文件.properties文件,最常用的是xml文件. Bean在xml文件中的配置 < ...
- ssm框架中applicationContext.xml文件中配置别名
在applicationContext.xml中配置如下: 通过以下property标签中给定name属性value属性及对应的值,来将domain包下所有实体类设置别名. 在xxxDao.xml中 ...
- spring-mvc.xml 和 application-context.xml的配置与深入理解
在java框架这个话题,前几篇文章是基于搭建ssm项目框架,以及web.xml的配置讲解,本篇主要就ssm框架的其他配置文件进行深入讲解,他们分别是:1.application-context.xml ...
- applicationContext.xml的配置
想必用过Spring的程序员们都有这样的感觉,Spring把逻辑层封装的太完美了(个人感觉View层封装的不是很好).以至于有的初学者都不知道Spring配置文件的意思,就拿来用了.所以今天我给大家详 ...
- 4. Spring 如何通过 XML 文件配置Bean,以及如何获取Bean
在 Spring 容器内拼凑 bean 叫做装配.装配 bean 的时候,你是在告诉容器,需要哪些 bean ,以及容器如何使用依赖注入将它们配合在一起. 理论上,bean 装配的信息可以从任何资源获 ...
- IDEA02 利用Maven创建Web项目、为Web应用添加Spring框架支持、bean的创建于获取、利用注解配置Bean、自动装配Bean、MVC配置
1 环境版本说明 Jdk : 1.8 Maven : 3.5 IDEA : 专业版 2017.2 2 环境准备 2.1 Maven安装及其配置 2.2 Tomcat安装及其配置 3 详细步骤 3.1 ...
随机推荐
- NoFragment重大bug
在activity中切换fragment,有以下几点问题需要注意: 例如做一个类似于这样的tab切换fragment的,有以下几点问题 1.切换fragment后,前几个fragment能透视,解决方 ...
- 适合小白/外行的git与github最基础最浅显教程
首先声明,这是适合小白/外行/初学者/学生看的最基础最简单的git与github教程,已经能使用svn,git等工具的朋友请不要看这篇文章来浪费时间了. 想进一步学习git的,推荐去廖雪峰博客学习. ...
- windows 下运行angualr/material2 项目
第一步:到github上clone angular/material2 项目 第二步:npm install 第三步: 打开git bash (cmd 或 powershell 是无法成功运行该项目 ...
- 【bird-front】全自动数据表格组件bird-grid
bird-grid是bird-front前端框架中实现的全自动数据表格组件.组件内部处理数据加载.分页.排序.查询.新增.编辑等一系列操作.让业务表格的开发从繁复的增删查改中脱离出来,编码简洁却又功能 ...
- 通过!important设置css样式优先级
CSS写在不同的地方有不同的优先级,一般 .css文件中的定义 < 元素style中的属性,但是如果使用!important,则会变得不一样,使用!important的css定义是拥有最高的优先 ...
- 怎样在Win7系统建立并开启Wifi热点
怎样在Win7系统建立并开启Wifi热点 步骤/方法: 1.首先,确定你的笔记本已经开启了无线. 点击电脑左下角的开始,在搜索程序和文件栏输入cmd. 2.在上图中找到Windows命令处理程序cmd ...
- Windows高速定时器,多媒体定时器winmm.dll库的使用
项目里面用到的这些看起来名字高大上的定时器测试下来也是非常不准.看了源码发现也是用System.Timers.Timer或者用的是Thread休眠的方式来实现的.100毫秒就不准了.直到一番搜索,发现 ...
- python3之运算符
1.python算术运算符 >>> a=15 >>> b=5 >>> a+b #加 20 >>> a-b #减 10 >& ...
- 使用Python实现的杨辉三角
def triangel(): print ' '*(20*3)+str(1) #定义起始两行 print ' '*(19*3)+str(1)+' '*5+str(1) for i in range( ...
- Jerry的UI5框架代码自学教程
SAP UI5对View元素基于jQuery的操作方式,使得其学习曲线相对Angular/React来说比较平缓,至少对于我个人而言是这样.对于已经有jQuery经验的前端开发人员来说很容易上手. 使 ...