一个applicationContext.xml配置

前端之家收集整理的这篇文章主要介绍了一个applicationContext.xml配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

web.xml

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>


<?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:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-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">

<!-- 使用annotation 自动注册bean -->
<context:component-scan base-package="com.idoo,com.fly">

</context:component-scan>

<!-- 使用annotation定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager"
proxy-target-class="true" />

<!-- For mail settings and future properties files -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:config.properties</value>
</list>
</property>
</bean>

<!-- JNDI DataSource for J2EE environments -->
<!-- <jee:jndi-lookup id="dataSource" jndi-name="java:MysqLDS"/> -->

<!-- <bean id="aismsDataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName}"
/> <property name="url" value="${jdbc.url}" /> <property name="username"
value="${jdbc.username}" /> <property name="password" value="${jdbc.password}"
/> <property name="maxActive" value="${jdbc.maxActive}" /> <property name="maxWait"
value="${jdbc.maxWait}" /> <property name="poolPreparedStatements" value="${jdbc.poolPreparedStatements}"
/> <property name="defaultAutoCommit" value="${jdbc.defaultAutoCommit}" />
</bean> -->


<!-- 默认DataSource配置 -->
<!-- aismsdb数据源 -->
<bean id="defaultDataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="shutdown">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource"
destroy-method="shutdown">
<property name="transactionManager" ref="jotm" />
<property name="driverName" value="${iosms.jdbc.driverClassName}" />
<property name="url" value="${iosms.jdbc.url}" />
</bean>
</property>
<property name="maxSize" value="30" />
<property name="minSize" value="5" />
<property name="user" value="${iosms.jdbc.username}" />
<property name="password" value="${iosms.jdbc.password}" />
</bean>

<bean id="dataSource" class="com.idoo.iosms.core.multidb.MultiDataSource"
destroy-method="shutdown">
<property name="dataSource">
<ref bean="defaultDataSource" />
</property>
</bean>
<!-- 多SessionFactory配置 -->
<!-- 默认SessionFactory配置 -->
<bean id="defaultSessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionfactorybean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.use_sql_comments">${hibernate.use_sql_comments}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop>
<!-- <prop key="hibernate.current_session_context_class">thread</prop>
<prop key="hibernate.connection.release_mode">after_transaction</prop> -->
<!-- 配置 EhCache缓存 -->
<prop key="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">${hibernate.ehcache_config_file}</prop>
<prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
<prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
</props>
</property>
<property name="packagesToScan" value="com.idoo.iosms.**.db.bean" />
</bean>

<bean id="sessionFactory" class="com.idoo.iosms.core.multidb.MultiSessionFactory">
<property name="sessionFactory">
<ref bean="defaultSessionFactory" />
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
<property name="fetchSize" value="20" />
</bean>

<!-- 事务管理器配置,单数据源事务 <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" /> </bean> -->
<!-- 事务管理器配置,多数据源分布式事务 -->
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransaction" ref="jotm" />
</bean>

<bean id="jotm" class="org.springframework.transaction.jta.Jotmfactorybean" />

<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- 以add,create,update,delete,merge开头的方法均启动事务,出现Exception时回滚 以find,get,pagedSearch,search,query,count开头的方法均为只读方法,不启动事务
其他方法支持事务,但不是必须 -->
<tx:method name="modify*" propagation="required"
rollback-for="Exception" />
<tx:method name="send*" propagation="required"
rollback-for="Exception" />
<tx:method name="save*" propagation="required"
rollback-for="Exception" />
<tx:method name="add*" propagation="required" rollback-for="Exception" />
<tx:method name="create*" propagation="required"
rollback-for="Exception" />
<tx:method name="update*" propagation="required"
rollback-for="Exception" />
<tx:method name="delete*" propagation="required"
rollback-for="Exception" />
<tx:method name="exec*" propagation="required"
rollback-for="Exception" />
<tx:method name="merge*" propagation="required"
rollback-for="Exception" />

<tx:method name="find*" propagation="SUPPORTS" read-only="true" />
<tx:method name="query*" propagation="SUPPORTS" read-only="true" />
<tx:method name="count*" propagation="SUPPORTS" read-only="true" />
<tx:method name="get*" propagation="SUPPORTS" read-only="true" />
<tx:method name="pagedSearch*" propagation="SUPPORTS"
read-only="true" />
<tx:method name="search*" propagation="SUPPORTS" read-only="true" />
<tx:method name="*" propagation="SUPPORTS" rollback-for="Exception" />
</tx:attributes>
</tx:advice>

<bean id="execsqlScriptInfoDaoImpl" class="com.idoo.iosms.core.dao.impl.ExecsqlScriptInfoDaoImpl">
<!--<property name="execsqlScriptInfoService" ref="execsqlScriptInfoService"
/> -->
</bean>

<bean id="systemVersionDaoImpl" class="com.idoo.iosms.core.dao.impl.SystemVersionDaoImpl">
<!--<property name="execsqlScriptInfoService" ref="execsqlScriptInfoService"
/> -->
</bean>

<bean id="execsqlScriptInfoService"
class="com.idoo.iosms.core.service.impl.ExecsqlScriptInfoServiceImpl">
<property name="execsqlScriptInfoDaoImpl" ref="execsqlScriptInfoDaoImpl" />
<property name="systemVersionDaoImpl" ref="systemVersionDaoImpl" />
</bean>

<bean id="execSystemxUpgradeService"
class="com.idoo.iosms.core.upgrade.impl.ExecSystemxUpgradeServiceImpl"
lazy-init="false">
<property name="execsqlScriptInfoService" ref="execsqlScriptInfoService" />
<property name="systemVersionService" ref="execsqlScriptInfoService" />
</bean>

<!-- 声明系统自动升级执行类 -->
<bean id="systemUpgradeExecuter" class="com.idoo.iosms.sys.upgrade.SystemxUpgradeExecuter"
lazy-init="false">
<property name="execSystemxUpgradeService" ref="execSystemxUpgradeService" />
</bean>
<!-- 动态加载外部的jar文件中包含的spring配置文件bean定义 -->
<bean id="dynamicLoadExtendJarSpringConfig"
class="com.idoo.iosms.sys.spring.DynamicLoadSpringbeanfactory"
lazy-init="false">
</bean>
<!-- 配置JCaptcha验证码功能
<bean id="captchaService"
class="com.octo.captcha.service.image.DefaultManageableImageCaptchaService">
<property name="captchaEngine">
<bean class="com.idoo.iosms.sys.action.common.JCaptchaEngine" />
</property>
验证码过期时间
<property name="minGuarantedStorageDelayInSeconds" value="600" />
</bean>
-->
<!-- 配置freemarkerManager -->
<bean id="freemarkerManager" class="org.apache.struts2.views.freemarker.FreemarkerManager" />


<!-- 引入事务配置文件 -->
<import resource="classpath:applicationContext-sys.xml" />

<!-- 引入ott配置文件 -->
<import resource="classpath:applicationContext-ott.xml" />

<!-- 引入spring security配置文件 -->
<import resource="classpath:applicationContext-security.xml" />

<!-- Add by Luozejun -->
<bean id="springContextUtil" class="com.idoo.ott.core.util.SpringContextUtil" />
</beans>

jdbc.properties:

hibernate.dialect=com.idoo.iosms.core.dao.dialect.Text2StrMysqLDialect hibernate.cache.provider_class=org.hibernate.cache.SingletonEhCacheProvider hibernate.ehcache_config_file=/ehcache.xml hibernate.cache.use_second_level_cache=false hibernate.cache.use_query_cache=false hibernate.hbm2ddl.auto=none hibernate.jdbc.fetch_size=10 hibernate.show_sql=false hibernate.use_sql_comments=false hibernate.format_sql=true hibernate.generate_statistics=true iosms.jdbc.driverClassName=com.MysqL.jdbc.Driver iosms.jdbc.url=jdbc:MysqL://172.21.13.19:3306/ivideo_ms?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull&amp;transformedBitIsBoolean=true&amp;pinGlobalTxToPhysicalConnection=true iosms.jdbc.username=root iosms.jdbc.password=coship jdbc.maxActive=200 jdbc.maxWait=100 jdbc.poolPreparedStatements=true jdbc.defaultAutoCommit=true iosms.exce.initsql.flag=true ott1.jdbc.driverClassName=com.MysqL.jdbc.Driver ott1.jdbc.url=jdbc:MysqL://172.21.13.19:3306/ivideo_bs?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull&amp;transformedBitIsBoolean=true&amp;pinGlobalTxToPhysicalConnection=true ott1.jdbc.username=root ott1.jdbc.password=coship ott1.memcached.server=172.21.13.19:12000 config.properties config.file = error_message.xml,event_message.xml

原文链接:https://www.f2er.com/xml/296600.html

猜你在找的XML相关文章