一个网上的Spring配置文件

来源:互联网 发布:transparent软件 编辑:程序博客网 时间:2024/05/05 01:40
<?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:util="http://www.springframework.org/schema/util"
        xmlns:lang="http://www.springframework.org/schema/lang"
        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-2.0.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
        http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.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
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
       
        <!-- サーバ用メッセージ -->
        <bean id="messageResource" class="jp.co.ntt.dc.framework.common.msg.MessageResource" />
        <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
            <property name="useCodeAsDefaultMessage" value="true" />
            <property name="basenames">
                <list>
                    <value>messages</value>
                    <value>common-messages</value>
                </list>
            </property>
        </bean>

        <!-- システム設定 -->
        <bean id="globalProperty" class="jp.co.ntt.dc.framework.server.common.GlobalProperties"
            factory-method="getInstance">
            <property name="operator">
                <bean class="jp.co.ntt.dc.framework.server.common.SystemPropertiesOperator" parent="daoBase" />
            </property>
        </bean>
        <!-- システム設定用DAO -->
        <bean name="propertiesOperator" class="jp.co.ntt.dc.framework.server.common.SystemPropertiesOperator"
            parent="daoBase" />

        <!-- SQLリソース -->
        <bean id="sqlResource" class="jp.co.ntt.dc.framework.server.config.SQLResource" init-method="init">
            <property name="locations">
                <list>
                    <value>classpath:fw.hql.xml</value>
                    <value>classpath:equip.hql.xml</value>
                    <value>classpath:filter.hql.xml</value>
                    <value>classpath:job.hql.xml</value>
                    <value>classpath:kdm.hql.xml</value>
                    <value>classpath:key.hql.xml</value>
                    <value>classpath:license.hql.xml</value>
                    <value>classpath:log.hql.xml</value>
                    <value>classpath:manage.hql.xml</value>
                    <value>classpath:master.hql.xml</value>
                    <value>classpath:theater.hql.xml</value>
                    <value>classpath:theaterstatus.hql.xml</value>
                    <value>classpath:common.hql.xml</value>
                    <value>classpath:sequence.hql.xml</value>
                </list>
            </property>
        </bean>

        <!-- フレームワーク用設定 -->
        <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>classpath:system.properties</value>
                </list>
            </property>
        </bean>

        <!-- データソースの設定 -->
        <jee:jndi-lookup id="dataSource" jndi-name="java:XADS/SecurityCenter"/>

        <!-- Hibernate SessionFactory -->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <property name="dataSource" ref="dataSource" />
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                    <prop key="hibernate.show_sql">true</prop>
                </props>
            </property>

            <!-- Must references all OR mapping files.-->
            <property name="mappingResources">
                <list>
                    <value>common.xml</value>
                    <value>securityCenter.xml</value>
                </list>
            </property>
        </bean>

        <!-- トランザクションの設定 -->
        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" />
        <tx:advice id="transactionAdvice" transaction-manager="transactionManager">
            <tx:attributes>
                <tx:method name="execute" />
                <tx:method name="send" />
            </tx:attributes>
        </tx:advice>

        <!-- トランザクション用AOPの設定 -->
        <aop:config>
            <aop:pointcut id="businessLogic"
                expression="execution(* jp.co.ntt.dc.framework.server.action.IActionBase.execute(..))" />
            <aop:advisor advice-ref="transactionAdvice" pointcut-ref="businessLogic" />
        </aop:config>

        <!-- DBアクセスヘルプ -->
        <bean id="dbHelper" class="jp.co.ntt.dc.framework.server.dao.DBAccessHelper">
            <property name="sessionFactory" ref="sessionFactory" />
        </bean>

        <!-- DAOの親クラス -->
        <bean id="daoBase" class="jp.co.ntt.dc.framework.server.dao.IDaoBase" abstract="true">
            <property name="dbHelper" ref="dbHelper" />
        </bean>

        <!-- Actionの親クラス -->
        <bean id="actionBase" class="jp.co.ntt.dc.framework.server.action.IActionBase" abstract="true">
            <property name="daoMap">
                <map>
                    <entry key="masterDAO">
                        <ref bean="masterDAO" />
                    </entry>
                    <entry key="CommonDAO">
                        <ref bean="CommonDAO" />
                    </entry>
                </map>
            </property>
        </bean>

        <!-- マスタテーブル用DAO -->
        <bean name="masterDAO" class="jp.co.ntt.dc.business.server.sc.common.dao.MasterDao" parent="daoBase" />

        <!-- システム共通DAO -->
        <bean name="CommonDAO" class="jp.co.ntt.dc.framework.server.dao.CommonDao" parent="daoBase" />

        <!-- Validateアクション -->
        <bean name="/ActionValidate" class="jp.co.ntt.dc.framework.server.action.ActionValidate" init-method="init">
            <property name="actionValidateDAO">
                <ref bean="actionValidateDAO" />
            </property>
        </bean>
        <!-- Validateアクション用のDAO -->
        <bean name="actionValidateDAO" class="jp.co.ntt.dc.framework.server.dao.ActionValidateDao" parent="daoBase" />

        <!-- RMIのサービス -->
        <bean name="remotingService" class="jp.co.ntt.dc.framework.server.handler.RemotingController">
            <property name="handlerMapping" ref="remotingMapping" />
        </bean>
        <!-- RMI Mapping -->
        <bean name="remotingMapping" class="jp.co.ntt.dc.framework.server.handler.HandlerMapping" />
        <!-- アクションの自動登録Bean -->
        <bean class="jp.co.ntt.dc.framework.server.handler.ActionBeanAutoRegistrant">
            <property name="handlerMapping" ref="remotingMapping" />
        </bean>
        <!-- RMIのインタフェース -->
        <bean name="/RemotingService" class="jp.co.ntt.dc.framework.server.handler.CenterAppHttpInvokerServiceExporter">
            <property name="service" ref="remotingService" />
            <property name="serviceInterface" value="jp.co.ntt.dc.framework.common.service.IRemotingService" />
        </bean>

        <!-- **Http Invokers Client** -->
        <!-- **Http Invokers FactoryBean** -->
        <bean id="remotingFactoryBean" class="jp.co.ntt.dc.framework.common.remoting.DCHttpInvokerProxyFactoryBean">
            <property name="serviceUrl"
                value="http://${server.ip}:${server.port}/${server.module}/${server.service.remoting}" />
            <property name="serviceInterface" value="jp.co.ntt.dc.framework.common.service.IRemotingService" />
        </bean>

        <!-- **Http Invokers RemotingProxy** -->
        <bean id="remotingProxy" class="jp.co.ntt.dc.framework.server.remoting.RemotingProxy">
            <property name="remotingFactoryBean" ref="remotingFactoryBean" />
            <property name="context" ref="context" />
        </bean>

        <!-- **Http Invokers Client Helper** -->
        <bean id="remotingHelper" class="jp.co.ntt.dc.framework.server.remoting.RemotingHelper">
            <property name="remotingProxy" ref="remotingProxy" />
        </bean>

        <!-- **Context** -->
        <bean id="context" class="jp.co.ntt.dc.framework.server.context.DCContext">
            <property name="defaultUserId" value="${default.userid}" />
            <property name="defaultUserPswd" value="${default.password}" />
            <property name="jndiMap">
                <map>
                    <entry key="java.naming.factory.initial" value="${java.naming.factory.initial}" />
                    <entry key="java.naming.factory.url.pkgs" value="${java.naming.factory.url.pkgs}" />
                    <entry key="java.naming.provider.url" value="${java.naming.provider.url}" />
                </map>
            </property>
        </bean>

    </beans>