spring 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: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"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
    <!--    ###========================= JavaMailConfig ========================    -->
<!--    <context:property-placeholder location="/WEB-INF/classes/jdbc.properties,/WEB-INF/classes/mail.properties" />-->
    <context:property-placeholder location="classpath:jdbc.properties,classpath:mail.properties" />

    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <property name="host" value="${mail.host}" />
        <property name="port" value="${mail.port}" />
        <property name="username" value="${mail.username}" />
        <property name="password" value="${mail.password}" />
        <property name="javaMailProperties">
            <props>
                <prop key="mail.smtp.auth">true</prop>
            </props>
        </property>
    </bean>
    <bean id="SendMailUtil" class="co.jp.neusoft.billing.fw.util.SendMailUtil">
        <property name="mailSender" ref="mailSender" />
        <property name="sendUser" value="${mail.from}" />
    </bean>

    <!--    ###========================= DataSource ========================    -->
    <bean id="dataSource" class="co.jp.neusoft.billing.fw.jdbc.dbcp.BillingDataSource"
        destroy-method="close" init-method="initBillingDataSource">
        <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="initialSize" value="${jdbc.initialSize}" />
        <property name="maxActive" value="${jdbc.maxActive}" />
        <property name="testOnBorrow" value="true" />
        <property name="validationQuery" value="SELECT 1" />
        <property name="validationQueryTimeout" value="3" />
        <property name="testWhileIdle" value="true" />
        <property name="timeBetweenEvictionRunsMillis" value="60000" />
        <property name="numTestsPerEvictionRun" value="3" />
        <property name="maxIdle" value="10" />
        <property name="minIdle" value="3" />
<!--        <property name="maxWait" value="${jdbc.maxWait}" />-->
    </bean>

    <!--    ###========================= MaxValueIncrementer ========================   -->
    <bean lazy-init="true" id="maxValueIncrementer" abstract="true"
          class="org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer">
        <property name="dataSource">
            <ref local="dataSource"/>
        </property>
    </bean>

    <bean id="transactionManager"
          class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource">
            <ref local="dataSource"/>
        </property>
    </bean>

    <!-- ###========================= TransactionManager ========================   -->
    <!-- ===@since 2.0 Start=== -->
    <!-- Enable @Transactional support -->
    <tx:annotation-driven />
    <aop:config>
        <aop:pointcut id="serviceOperation" expression="execution(* co.jp.neusoft.billing..services.*Service.*(..))"/>
        <aop:advisor pointcut-ref="serviceOperation" advice-ref="txAdvice"/>
    </aop:config>
    <tx:advice id="txAdvice">
        <tx:attributes>
                <tx:method name="get*" read-only="true"/>
                <tx:method name="find*" read-only="true"/>
                <tx:method name="select*" read-only="true"/>
                <tx:method name="*" propagation="REQUIRED" rollback-for="Exception" />
        </tx:attributes>
    </tx:advice>
    
    <!-- Enable @AspectJ support -->
    <!--    <aop:aspectj-autoproxy />-->
    <!-- ===@since 2.0  End=== -->

     <bean id="actionLogAroundAdvisor" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
            <property name="interceptorNames">
            <list> 
                <value>actionLogAroundAdvice</value> 
            </list> 
        </property> 
        <property name="beanNames"> 
            <list> 
                <value>/*</value>                   
            </list>
            </property>
     </bean>

    <bean id="actionLogAroundAdvice" class="co.jp.neusoft.billing.fw.aop.ActionLogAroundAdvice"/>
    <aop:config>
        <aop:aspect ref="serviceLogAroundAdvice">
            <aop:around pointcut="execution(* co.jp.neusoft.billing.app..services.*Service.*(..))" method="invoke"/>
        </aop:aspect>
    </aop:config>
    <bean id="serviceLogAroundAdvice" class="co.jp.neusoft.billing.fw.aop.ServiceLogAroundAdvice"/>
    <!--    ###========================= SQL Map DAO ========================   -->
    <bean id="sqlMapDao.rakuten" abstract="true"
          class="org.springframework.orm.ibatis.support.SqlMapClientDaoSupport">
        <property name="sqlMapClient">
            <ref local="sqlMapClient"/>
        </property>
    </bean>

    <bean id="sqlMapClient"
          class="co.jp.neusoft.billing.fw.dao.IBatisSqlMapClientFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="sqlMapLocations"
                  value="classpath*:co/jp/neusoft/billing/**/dao/*-sql-map.xml"/>
        <property name="statementCachingEnabled" value="true"/>
        <property name="cacheModelsEnabled" value="true"/>
        <property name="useStatementNamespaces" value="true"/>
    </bean>
   
    <bean id="BillingFrameworkStaticServiceBean"
          class="co.jp.neusoft.billing.fw.services.BillingStaticServiceBean" />

    <bean id="BasePagerService"
          class="co.jp.neusoft.billing.fw.services.BasePagerService" />

    <bean id="BillingDateUtil" class="co.jp.neusoft.billing.fw.util.DateUtil">
        <property name="dateDao" ref="BillingBaseDao" />
    </bean>
    <bean id="BillingBaseDao" class="co.jp.neusoft.billing.fw.dao.AbstractDao" parent="sqlMapDao.rakuten" scope="prototype" />

    <!-- 設定ファイルのインポート(仮) -->
    <import resource="classpath*:co/jp/neusoft/billing/**/conf/*-context.xml"/>

    <bean id="propertiesConfiguration"
        class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="singleton" value="true" />
        <property name="fileEncoding" value="utf8" />
        <property name="ignoreResourceNotFound" value="true" />
        <property name="locations">
            <list>
                <value>classpath:config.properties</value>
            </list>
        </property>
    </bean>

    <!-- XMemcached Client Config -->
    <bean name="memcachedClientBuilder" class="net.rubyeye.xmemcached.XMemcachedClientBuilder">
        <constructor-arg>
            <list>
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg value="${billing.memcached.server.hostip}" />
                    <constructor-arg value="${billing.memcached.server.port}" />
                </bean>
            </list>
        </constructor-arg>

        <property name="connectionPoolSize" value="5" />
        <property name="commandFactory">
            <bean class="net.rubyeye.xmemcached.command.BinaryCommandFactory" />
        </property>
        <property name="sessionLocator">
            <bean class="net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator" />
        </property>
        <property name="transcoder">
            <bean class="net.rubyeye.xmemcached.transcoders.SerializingTranscoder" />
        </property>
    </bean>

    <bean name="memcachedClient" factory-bean="memcachedClientBuilder" factory-method="build" destroy-method="shutdown" />

</beans>

猜你喜欢

转载自haizhan.iteye.com/blog/1299583
今日推荐