SSH applicationContext.xml文件配置
- <?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-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/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
- <!-- 该配置文件进行基本的Spring和Hibernate的集成配置。
- 与业务相关的配置将放在其它的Spring配置文件中。
- -->
- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <value>WEB-INF/classes/conf.properties</value>
- </list>
- </property>
- </bean>
- <!-- 该 BeanPostProcessor 将自动起作用,对标注 @Autowired 的 Bean 进行自动注入 -->
- <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
- <!-- 自动搜索路径 -->
- <context:component-scan base-package="com.agree" />
- <!-- 以下是应用的一些常用配置,包括数据源、 -->
- <bean id="datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
- <property name="driverClass" value="${jdbc.driverClassName}" />
- <property name="jdbcUrl" value="${jdbc.url}" />
- <property name="user" value="${jdbc.username}"></property>
- <property name="password" value="${jdbc.password}"></property>
- <property name="minPoolSize"><value>3</value></property>
- <property name="maxPoolSize"><value>5</value></property> <!--连接池中保留的最大连接数。Default: 15 -->
- <property name="maxIdleTime"><value>10</value></property><!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
- <property name="acquireIncrement"><value>30</value></property>
- <property name="maxStatements"><value>0</value></property>
- <property name="initialPoolSize"><value>3</value></property><!--初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
- <property name="idleConnectionTestPeriod"><value>60</value></property><!--每60秒检查所有连接池中的空闲连接。Default: 0 -->
- <property name="testConnectionOnCheckin"><value>false</value></property>
- <property name="acquireRetryAttempts"><value>3</value></property><!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
- <property name="checkoutTimeout"><value>1000</value></property> <!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出 SQLException,如设为0则无限期等待。单位毫秒。Default: 0 -->
- <property name="breakAfterAcquireFailure"><value>false</value></property>
- <property name="testConnectionOnCheckout"><value>false</value></property>
- </bean>
- <!-- HIERNANATE配置 -->
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="dataSource" ref="datasource"/>
- <property name="mappingResources">
- <list>
- <value>cn/com/agree/domain/ProductVO.hbm.xml</value>
- </list>
- </property>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">${hibernate.dialect}</prop>
- <prop key="hibernate.show_sql">true</prop>
- <prop key="hibernate.generate_statistics">true</prop>
- <prop key="hibernate.connection.release_mode">auto</prop>
- <prop key="hibernate.autoReconnect">true</prop>
- <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
- <prop key="hibernate.current_session_context_class">thread</prop>
- <prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop>
- <!--使用二级缓存 -->
- <prop key="hibernate.cache.use_query_cache">true</prop>
- <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
- </props>
- </property>
- </bean>
- <!-- 配置数据库的事务管理器-->
- <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" >
- <property name="sessionFactory"><ref bean="sessionFactory" /></property>
- </bean>
- <tx:advice id="txAdvice" transaction-manager="transactionManager" >
- <tx:attributes>
- <tx:method name="*" rollback-for="Exception" propagation="REQUIRED" read-only="true"/>
- </tx:attributes>
- </tx:advice>
- <aop:config expose-proxy="true">
- <!-- 只对业务逻辑层实施事务 -->
- <aop:pointcut id="txPointcut" expression="execution(* cn.javass..service..*.*(..))" />
- <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
- </aop:config>
- <bean id="habernateDao" class="cn.com.agree.dao.core.DbOperation">
- <property name="sessionFactory"><ref local="sessionFactory" /></property>
- </bean>
- </beans>
SSH applicationContext.xml文件配置的更多相关文章
- SSH框架整合--applicationContext.xml文件配置实例
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...
- SSH web.xml文件配置
启动一个WEB项目的时候, WEB容器会去读取它的配置文件web.xml web.xml中配置的加载优先级:context-param -> listener -> filter -> ...
- spring +springmvc+mybatis组合applicationContext.xml文件配置
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...
- applicationContext.xml文件配置模板
<?xml version="1.0" encoding="gb2312"?><!-- Spring配置文件的DTD定义-->< ...
- ssh2学习-applicationContext.xml文件配置-----<context:annotation-config/>详解
当我们需要使用BeanPostProcessor时,直接在Spring配置文件中定义这些Bean显得比较笨拙,例如: 使用@Autowired注解,必须事先在Spring容器中声明AutowiredA ...
- Spring框架入门之基于xml文件配置bean详解
关于Spring中基于xml文件配置bean的详细总结(spring 4.1.0) 一.Spring中的依赖注入方式介绍 依赖注入有三种方式 属性注入 构造方法注入 工厂方法注入(很少使用,不推荐,本 ...
- SSH整合,applicationContext.xml中配置hibernate映射文件问题
今天在applicationContext.xml中配置sessionFactory时遇到了各种头疼的问题,现在总结一下: 1.<property name="mappingDirec ...
- Spring MVC框架下在java代码中访问applicationContext.xml文件中配置的文件(可以用于读取配置文件内容)
<bean id="propertyConfigurer" class="com.****.framework.core.SpringPropertiesUtil& ...
- ssm框架中applicationContext.xml文件中配置别名
在applicationContext.xml中配置如下: 通过以下property标签中给定name属性value属性及对应的值,来将domain包下所有实体类设置别名. 在xxxDao.xml中 ...
随机推荐
- 记一次纠结Macbook 重装OS X的系统
本文所有图片都是网上截图,不是实操环境.本文不具有教学意义. 起因:Macbook 白苹果了,无限菊花. 我的Macbook 只能装 OS X Mountain Lion 10.8,但是呢 MacBo ...
- ActiveReports 9 新功能:可视化查询设计器(VQD)介绍
在最新发布的ActiveReports 9报表控件中添加了多项新功能,以帮助你在更短的时间里创建外观绚丽.功能强大的报表系统,本文将重点介绍可视化数据查询设计器,无需手动编写任何SQL语句,主要内容如 ...
- SQL Server性能影响的重要结论
第一次访问数据会比接下来的访问慢的多,因为它要从磁盘读取数据然后写入到缓冲区: 聚合查询(sum,count等)以及其他要扫描大部分表或索引的查询需要大量的缓冲,而且如果它导致SQL Server从缓 ...
- vundle按照YouComplete
https://github.com/VundleVim/Vundle.vim http://www.jianshu.com/p/d908ce81017a?nomobile=yes http://ww ...
- Win10的分辨率问题
个人觉得win10扁平化的界面给人全新的感觉,但安装后,发现分辨率只有1280x720.1152x864.1024x768(推荐).800x600,不管调整哪一个,都觉得分辨率还是有问题,看起来字体. ...
- Exchange Server 2013 一步步安装图解
前言: 这是一份为Exchange菜鸟准备的2013版本安装文档,安装环境为Windows Server 2012 DataCenter 版本,在安装之前,我对安装Exchange也是处于一无所知的状 ...
- FIM 2010: Kerberos Authentication Setup
The goal of this article is to provide some background information regarding the Kerberos related co ...
- 安卓问题集-Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
错误出现原因: 1.没有 AndroidManifest.xml file文件(出现几率较小) 2. 是你在外面修改了包名而在 AndroidManifest.xml file.文件中没有同步过去导致 ...
- CAS实现单点登入(sso)经典教程
本教程我已按照步骤实现,不过要深入了解单点登入还需要进一步的学习,掌握其中的精髓. 一.简介 1.cas是有耶鲁大学研发的单点登录服务器 2.本教材所用环境 Tomcat7.2 JDK6 CAS Se ...
- JAVA基础学习day25--Socket基础二-多线程
一.上传图片 1.1.示例 /* 上传图片 */ import java.net.*; import java.io.*; import java.util.*; import java.text.* ...