Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1376125
  • 博文数量: 205
  • 博客积分: 6732
  • 博客等级: 准将
  • 技术积分: 2835
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-04 17:59
文章分类

全部博文(205)

文章存档

2016年(1)

2015年(10)

2014年(1)

2013年(39)

2012年(23)

2011年(27)

2010年(21)

2009年(55)

2008年(28)

我的朋友

分类: Java

2011-07-09 09:31:23

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
    xmlns:xsi=""
    xmlns:jee=""
    xmlns:tx=""
    xmlns:context=""
    xmlns:aop=""
    xsi:schemaLocation=" /spring-beans-2.5.xsd
     /spring-tx-2.5.xsd
     /spring-jee-2.5.xsd
     /spring-context-2.5.xsd
     /spring-aop-2.5.xsd"

    default-lazy-init="true">
    <import resource="applicationContext-aop.xml" />
    <!-- 使用annotation 自动注册bean,并保证@Required,@Autowired的属性被注入 -->
    <context:component-scan base-package="com.tydic" />
    <context:annotation-config />
    
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass">
            <value>oracle.jdbc.driver.OracleDriver</value>
        </property>
        <property name="jdbcUrl">
            <value>jdbc:oracle:thin:@192.168.161.81:1521:devdb81</value>
        </property>
        <property name="user">
            <value>admin</value>
        </property>
        <property name="password">
            <value>admin</value>
        </property>
        <property name="initialPoolSize">
            <value>10</value>
        </property>
        <property name="minPoolSize">
            <value>10</value>
        </property>
        <property name="maxPoolSize">
            <value>10</value>
        </property>
        <property name="acquireIncrement">
            <value>10</value>
        </property>
        <property name="maxIdleTime">
            <value>600</value>
        </property>
        <property name="idleConnectionTestPeriod">
            <value>900</value>
        </property>
        <property name="maxStatements">
            <value>100</value>
        </property>
        <property name="autoCommitOnClose">
            <value>true</value>
        </property>
    </bean>
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.format_sql">false</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
                <prop key="hibernate.cache.use_query_cache">true</prop>
                <prop key="hibernate.cache.provider_class">
                    org.hibernate.cache.EhCacheProvider
                </prop>
                
                <!-- <prop key="hibernate.hbm2ddl.auto">update</prop>-->
            </props>
        </property>
        <property name="packagesToScan">
            <list>
                <value>com.tydic.isip.entity</value>
            </list>
        </property>
    </bean>
    <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <!--<property name="configLocation" value="WEB-INF/classes/sql-map-config.xml" />-->
         <property name="configLocation" value="classpath:/sql-map-config.xml" />
    </bean>
    
    <!-- 事务管理器配置,单数据源事务 -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <!-- 使用annotation定义事务 -->
    <tx:annotation-driven transaction-manager="transactionManager" />
    <!-- aop事务设置 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="get*" read-only="true" />
            <tx:method name="find*" read-only="true" />
            <tx:method name="query*" read-only="true" />
            <tx:method name="save*" propagation="REQUIRED" rollback-for="Exception" />
            <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception" />
            <tx:method name="del*" propagation="REQUIRED" rollback-for="Exception" />
            <tx:method name="*" propagation="REQUIRED" rollback-for="Exception" />
        </tx:attributes>
    </tx:advice>
    <!-- pointcut定义 -->
    <aop:config proxy-target-class="true">
        <aop:pointcut id="txPointcut"
            expression="execution(* com.tydic.isip.*.service.*.*(..))" />
        <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" order="1" />
    </aop:config>
    <bean id="systemConfig" class="com.tydic.framework.SystemConfig">
        <property name="systemCode" value="obs" />
        <property name="defaultSessionFactoryId" value="sessionFactory" />
        <property name="defaultDataSourceId" value="dataSource" />
        <property name="isIbaitsSupported" value="true" />
        <property name="defaultSqlMapClient" value="sqlMapClient" />
    </bean>
        <bean id="WebServerMsg" class="com.tydic.isip.web.webServic.WebServerMsg">
        <property name="ip" value="" />
     </bean>
</beans>


阅读(804) | 评论(0) | 转发(1) |
0

上一篇:java分布式学习笔记

下一篇:Spring IOC容器

给主人留下些什么吧!~~