一个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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值