天天看点

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:context="http://www.springframework.org/schema/context" 

xmlns:aop="http://www.springframework.org/schema/aop" 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/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 

           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> 

<bean id="datasource" class="org.apache.commons.dbcp.basicdatasource"  destroy-method="close"> 

<property name="driverclassname" value="com.mysql.jdbc.driver"> 

</property> 

<property name="url" value="jdbc:mysql://localhost:3306/huike"> 

<property name="username" value="root"></property> 

<property name="password" value="rootcode"></property> 

<!-- start 江明 优化连接池 --> 

<!-- 连接池启动时的初始值 --> 

<property name="initialsize" value="1" /> 

<!-- 连接池的最大值 --> 

<property name="maxactive" value="500" /> 

<!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxidle为止 --> 

<property name="maxidle" value="2" /> 

<!--  最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 --> 

<property name="minidle" value="1" /> 

<!-- end --> 

</bean> 

<bean id="loglistener" class="com.huike.hidp.system.log.loglistener"></bean> 

<bean id="sessionfactory" 

class="org.springframework.orm.hibernate3.localsessionfactorybean"> 

<property name="datasource"> 

<ref bean="datasource" /> 

<property name="eventlisteners"> 

<map> 

<entry key="post-commit-update"> 

<ref bean="loglistener" /> 

</entry> 

<entry key="post-commit-insert"> 

<entry key="post-commit-delete"> 

</map> 

<property name="hibernateproperties"> 

<props> 

<prop key="hibernate.hbm2ddl.auto">update</prop> <!-- 首次布署项目时才须执行  --> 

<prop key="hibernate.dialect"> 

org.hibernate.dialect.mysqlinnodbdialect 

</prop> 

<prop key="hibernate.show_sql">true</prop>    <!-- 显示sql语句  --> 

<prop key="hibernate.format_sql">true</prop> 

</props> 

<property name="mappingresources"> 

<list> 

<!-- start eric zhang 新增桌面设计表 --> 

<value>com/huike/hidp/system/homepage/vo/desktopsetup.hbm.xml</value> 

<!-- end  --> 

<value> 

com/huike/hidp/system/homepage/vo/usermenu.hbm.xml 

</value> 

com/huike/hidp/system/logon/vo/user.hbm.xml 

com/huike/hidp/basedata/system/vo/sex.hbm.xml 

com/huike/hidp/basedata/system/vo/job.hbm.xml 

com/huike/hidp/basedata/system/vo/jobtitle.hbm.xml 

com/huike/hidp/basedata/system/vo/knowledge.hbm.xml 

com/huike/hidp/basedata/system/vo/marriage.hbm.xml 

com/huike/hidp/basedata/system/vo/national.hbm.xml 

com/huike/hidp/basedata/system/vo/polity.hbm.xml 

com/huike/hidp/system/log/vo/systemlog.hbm.xml 

com/huike/hidp/system/organization/unit/vo/unit.hbm.xml 

com/huike/hidp/system/organization/job/vo/unitjob.hbm.xml 

com/huike/hidp/system/organization/job/vo/userjob.hbm.xml 

com/huike/hidp/system/organization/unitdeparement/vo/unitdepartment.hbm.xml 

com/huike/hidp/system/organization/unitdeparement/vo/userunitdepartment.hbm.xml 

com/huike/hidp/system/organization/position/vo/unitposition.hbm.xml 

com/huike/hidp/system/organization/position/vo/userunitposition.hbm.xml 

com/huike/hidp/message/innersm/vo/innersm.hbm.xml 

com/huike/hidp/basedata/system/vo/position.hbm.xml 

com/huike/hidp/system/privilege/user/vo/unituser.hbm.xml 

com/huike/hidp/system/privilege/resource/vo/resource.hbm.xml 

com/huike/hidp/system/privilege/role/vo/role.hbm.xml 

com/huike/hidp/system/privilege/role/vo/unitrole.hbm.xml 

com/huike/hidp/system/privilege/role/vo/userrole.hbm.xml 

com/huike/hidp/system/privilege/resoperation/vo/resoperation.hbm.xml 

com/huike/hidp/system/privilege/role/vo/roleresource.hbm.xml 

<!-- start 李永春  邮件管理--> 

com/huike/hidp/message/mail/vo/mail.hbm.xml 

com/huike/hidp/message/mail/vo/mailattch.hbm.xml 

com/huike/hidp/message/mail/vo/mailcapacity.hbm.xml 

com/huike/hidp/message/mail/vo/mailcontact.hbm.xml 

com/huike/hidp/message/mail/vo/maildirectory.hbm.xml 

com/huike/hidp/message/mail/vo/mailinfo.hbm.xml 

com/huike/hidp/message/mail/vo/pop3mailsetup.hbm.xml 

com/huike/hidp/message/mail/vo/mailuser.hbm.xml 

com/huike/hidp/system/address/vo/cardcasegroupdet.hbm.xml 

com/huike/hidp/system/address/vo/cardcasegroupmas.hbm.xml 

<!-- start 江明  工作流管理--> 

<value>jbpm.repository.hbm.xml</value> 

<value>jbpm.execution.hbm.xml</value> 

<value>jbpm.history.hbm.xml</value> 

<value>jbpm.task.hbm.xml</value> 

<value>jbpm.identity.hbm.xml</value> 

<value>com/huike/hidp/system/workflow/vo/processstate.hbm.xml</value> 

</list> 

<!-- start 江明  配置事务 --> 

<!-- 配置事务管理器 --> 

<bean id="transactionmanager" 

class="org.springframework.orm.hibernate3.hibernatetransactionmanager"> 

<property name="sessionfactory"> 

<ref bean="sessionfactory" /> 

<!-- 配置事务的传播特性 --> 

<tx:advice id="txadvice" transaction-manager="transactionmanager"> 

<tx:attributes> 

<tx:method name="get*" read-only="true"/> 

<tx:method name="set*" read-only="true"/> 

<tx:method name="*" propagation="required"/> 

</tx:attributes> 

</tx:advice> 

<!-- 那些类的哪些方法参与事务 --> 

<aop:config> 

<aop:pointcut id="allmanagermethod" 

expression="execution(* com.huike..*.impl..*.*(..))" /> 

<aop:advisor pointcut-ref="allmanagermethod" 

advice-ref="txadvice" /> 

</aop:config>

</beans>