spring applicationcontext配置


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<!-- DataSource Configurer -->
<!--PropertyPlaceholderConfigurer实现了BeanFactoryPostProcessor,将配置信息配置在property文件中 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WEB-INF/system-config.properties" />
</bean>

<!-- C3P0 DataSource -->

<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"
lazy-init="false">
<property name="driver">
<value>${jdbc.driverClassName}</value>
</property>
<property name="driverUrl">
<value>${jdbc.url}</value>
</property>
<property name="user">
<value>${jdbc.username}</value>
</property>
<property name="password">
<value>${jdbc.password}</value>
</property>
<property name="maximumConnectionCount">
<value>${jdbc.maximumConnectionCount}</value>
</property>
<!--
<property name="houseKeepingSleepTime">
<value>${jdbc.houseKeepingSleepTime}</value>
</property>
-->
<property name="houseKeepingTestSql">
<value>${jdbc.houseKeepingTestSql}</value>
</property>
<property name="testBeforeUse">
<value>${jdbc.testBeforeUse}</value>
</property>
<property name="alias">
<value>${jdbc.alias}</value>
</property>
<property name="simultaneousBuildThrottle">
<value>${jdbc.simultaneousBuildThrottle}</value>
</property>
<property name="trace">
<value>${jdbc.trace}</value>
</property>
</bean>


<!--
Hibernate SessionFactory Automatically validate or export schema DDL
to the database when the SessionFactory is created. With create-drop,
the database schema will be dropped when the SessionFactory is closed
explicitly. eg. validate | update | create | create-drop <prop
key="hibernate.hbm2ddl.auto">update</prop>
-->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<!-- 设置与表格的映射文件 -->
<value>
com/jsict/gcfm/vo/TArea.hbm.xml,
com/jsict/gcfm/vo/TDepart.hbm.xml,
com/jsict/gcfm/vo/TMatGoodsList.hbm.xml,
com/jsict/gcfm/vo/TMatticket.hbm.xml,
com/jsict/gcfm/vo/TMbrTerList.hbm.xml,
com/jsict/gcfm/vo/TMember.hbm.xml,
com/jsict/gcfm/vo/TMessage.hbm.xml,
com/jsict/gcfm/vo/TPhoto.hbm.xml,
com/jsict/gcfm/vo/TPresent.hbm.xml,
com/jsict/gcfm/vo/TProduct.hbm.xml,
com/jsict/gcfm/vo/TrBigdategoods.hbm.xml,
com/jsict/gcfm/vo/TrCompetitioninfo.hbm.xml,
com/jsict/gcfm/vo/TrMaterial.hbm.xml,
com/jsict/gcfm/vo/TrOrder.hbm.xml,
com/jsict/gcfm/vo/TrOrdGoodsList.hbm.xml,
com/jsict/gcfm/vo/TrReturngoods.hbm.xml,
com/jsict/gcfm/vo/TrRtnGoodsList.hbm.xml,
com/jsict/gcfm/vo/TrSaleAll.hbm.xml,
com/jsict/gcfm/vo/TrSaleSingle.hbm.xml,
com/jsict/gcfm/vo/TrStock.hbm.xml,
com/jsict/gcfm/vo/TTerminal.hbm.xml,
com/jsict/gcfm/vo/TOperatelog.hbm.xml,
com/jsict/gcfm/vo/TMessageStatus.hbm.xml,
com/jsict/gcfm/vo/TSystem.hbm.xml
</value>

</property>
<property name="hibernateProperties">
<!-- hibernate 配置的属性 -->
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.connection.autocommit">false</prop>
<prop key="hibernate.connection.release_mode">after_statement</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.max_fetch_depth">15</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean
class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
</entry>
</map>
</property>
</bean>

<!-- hibernate 事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- hibernate 申明式事务管理配置 -->
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributeSource">
<value>
<!--
com.jsict.gcfm.demo.TestAction.find*=PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-ESPException,-RuntimeException
-->
com.jsict.gcfm.goodsmgr.ordermanage.OrderManageService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.ordermanage.OrderManageService.saveOrder=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.returnedgoods.ReturnedGoodsService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.returnedgoods.ReturnedGoodsService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.ordersummarize.OrderSummarizeService.upload*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.terminal.notic.NoticMessageService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.terminal.TerminalService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.terminal.TerminalService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.terminal.TerminalService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.employee.EmployeeService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.employee.EmployeeService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.employee.EmployeeService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.product.ProductService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.product.ProductService.search*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.product.ProductService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.product.ProductService.find*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.product.ProductService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.present.PresentService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.present.PresentService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.present.PresentService.search*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.present.PresentService.find*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.basicinfo.present.PresentService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleSingleService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleSingleService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleSingleService.search*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleSingleService.find*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleSingleService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleAllService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleAllService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleAllService.search*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleAllService.find*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.salesvolume.SaleAllService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.material.MaterialService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.material.MaterialService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.material.MaterialService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.material.MaterialService.search*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.material.MaterialService.find*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.search*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.find*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.stock.StockService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.stock.StockService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.stock.StockService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.stock.StockService.search*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.goodsmgr.stock.StockService.find*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.create*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.delete*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.update*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.search*=PROPAGATION_REQUIRED,-gcfmException
com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.find*=PROPAGATION_REQUIRED,-gcfmException

</value>
</property>
</bean>

<bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>

<bean
class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
<property name="transactionInterceptor" ref="transactionInterceptor" />
</bean>

<!-- Hibernate 3.0's JMX statistics service -->
<!-- Implements the StatisticsServiceMBean management interface -->
<bean name="broadengate:type=HibernateStatistics" class="org.hibernate.jmx.StatisticsService">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="baseAction" abstract="true" class="com.jsict.gcfm.BaseAction"
init-method="init">
<!--
可以初始化所有action公用的内容 <property name="logService" ref="logService" />
-->
<property name="pageSize">
<value>${pagemax}</value>
</property>
<property name="productService" ref="productService" />
<property name="employeeService" ref="employeeService" />
<property name="terminalService" ref="terminalService" />
<property name="departmentService" ref="departmentService" />
<property name="areaService" ref="areaService" />
</bean>


<import resource="/spring/applicationContext-competitiveinfo.xml" />
<import resource="/spring/applicationContext-photosmanage.xml" />
<import resource="/spring/applicationContext-salesvolume.xml" />
<import resource="/spring/applicationContext-present.xml" />
<import resource="/spring/applicationContext-product.xml" />
<import resource="/spring/applicationContext-ordermanage.xml" />
<import resource="/spring/applicationContext-ordersummarize.xml" />
<import resource="/spring/applicationContext-orderreach.xml" />
<import resource="/spring/applicationContext-returnedgoods.xml" />
<import resource="/spring/applicationContext-returnedsummarize.xml" />
<import resource="/spring/applicationContext-returnedreply.xml" />
<import resource="/spring/applicationContext-login.xml" />

<import resource="/spring/applicationContext-logdb.xml" />

<import resource="/spring/applicationContext-noticmessage.xml" />

<import resource="/spring/applicationContext-material.xml" />

<import resource="/spring/applicationContext-area.xml" />
<import resource="/spring/applicationContext-department.xml" />
<import resource="/spring/applicationContext-employee.xml" />
<import resource="/spring/applicationContext-terminal.xml" />
<import resource="/spring/applicationContext-system.xml" />
<import resource="/spring/applicationContext-stock.xml" />
</beans>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<?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:p="http://www.springframework.org/schema/p" 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.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <description>Spring公共配置文件</description> <!-- mes 的數據庫 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <property name="jdbcUrl" value="jdbc:oracle:thin:@10.142.252.132:1521:mestest"/> <property name="maxPoolSize" value="10"></property> <property name="maxIdleTime" value="1800"></property> <property name="minPoolSize" value="1"></property> <property name="initialPoolSize" value="1"></property> <property name="properties"> <ref bean="mesDatasourcePropertiesFactory" /> </property> </bean> <!-- c3p0数据源的一个专有属性,只可以存放密码和用户名 --> <bean id="mesDatasourcePropertiesFactory" class="com.ccc.db.impl.DatasourcePropertiesFactory" factory-method="getProperties"> <!-- userName--> <constructor-arg type="java.lang.String"> <value>jxg/Qr4VbxU=</value> </constructor-arg> <!-- password --> <constructor-arg type="java.lang.String"> <value>jxg/Qr4VbxU=</value> </constructor-arg> <!-- 生产环境模式 ,才特殊处理加密密码--> <constructor-arg type="java.lang.String"> <value>true</value> </constructor-arg> </bean> <!-- ptc windchill的數據庫 --> <bean id="dataSourcePdm" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <property name="jdbcUrl" value="jdbc:oracle:thin:@10.142.252.132:1521:mesdev"/> <property name="maxPoolSize" value="10"></property> <property name="maxIdleTime" value="1800"></property> <property name="minPoolSize" value="1"></property> <property name="initialPoolSize" value="1"></property> <property name="properties"> <ref bean="ptcDatasourcePropertiesFactory" /> </property> </bean> <!-- c3p0数据源的一个专有属性,只可以存放密码和用户名 --> <bean id="ptcDatasourcePropertiesFactory" class="com.ccc.db.impl.DatasourcePropertiesFactory" factory-method="getProperties"> <!-- userName--> <constructor-arg type="java.lang.String"> <value>WgDH/SDIJfs=</value> </constructor-arg> <!-- password --> <constructor-arg type="java.lang.String"> <value>WgDH/SDIJfs=</value> </constructor-arg> <!-- 生产环境模式 ,才特殊处理加密密码--> <constructor-arg type="java.lang.String"> <value>true</value> </constructor-arg> </bean> <!-- mes數據源代理 --> <bean id="dataSourceProxy" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy" p:targetDataSource-ref="dataSource"/> <!-- 对web包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能--> <context:component-scan base-package="com.ccc"/> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" p:order="0" /> <!-- 配置事务管理器 針對MES數據庫--> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager " p:dataSource-ref="dataSourceProxy"/> <!-- 配置事务的传播特性 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="add*" propagation="REQUIRED"/> <tx:method name="insert*" propagation="REQUIRED"/> <tx:method name="delete*" propagation="REQUIRED"/> <tx:method name="update*" propagation="REQUIRED"/> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <!-- 那些类的哪些方法参与事务 --> <aop:config> <aop:pointcut id="allManagerMethod" expression="execution(* com.ccc..*.*(..))"/> <aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/> </aop:config> <!-- 配置事务管理器,這個事務性是爭對pdm數據庫的 --> <bean id="transactionManagerPdm" class="org.springframework.jdbc.datasource.DataSourceTransactionManager " p:dataSource-ref="dataSourcePdm"/> <!-- 配置事务的传播特性 --> <tx:advice id="txAdvicePdm" transaction-manager="transactionManagerPdm"> <tx:attributes> <tx:method name="add*" propagation="REQUIRED"/> <tx:method name="insert*" propagation="REQUIRED"/> <tx:method name="delete*" propagation="REQUIRED"/> <tx:method name="update*" propagation="REQUIRED"/> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <!-- 那些类的哪些方法参与事务 --> <aop:config> <aop:pointcut id="allManagerMethodPdm" expression="execution(* com.ccc.pdm..*.*(..))"/> <aop:advisor pointcut-ref="allManagerMethodPdm" advice-ref="txAdvicePdm"/> </aop:config> <!-- ibatis插件 --> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" p:dataSource-ref="dataSourceProxy"> <property name="configLocation"> <value>classpath:SqlMapConfig.xml</value> </property> </bean> <bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate"> <property name="sqlMapClient"> <ref bean="sqlMapClient" /> </property> </bean> <!-- 配置要拦截的url,防止2次提交或做其他數據統計用 <bean id="doubleSubmitInterceptor" class="com.ccc.filter.DoubleSubmitInterceptor"> <property name="mappingURL" value=".html" /> <property name="viewURL" value=".html" /> </bean> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" p:order="0"> <property name="interceptors"> <list> <ref bean="doubleSubmitInterceptor"/> </list> </property> </bean> --> <!-- JDBC template注入及事務配置 --> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource"><ref bean="dataSourceProxy"/></property> </bean> </beans>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值