天天看點

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>