<?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:mvc="http://www.springframework.org/schema/mvc" \ xmlns:task="http://www.springframework.org/schema/task" 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/tx http://www.springframework.org/schema/tx/spring-tx-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/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<!-- xmlns:这个东西意思是引用一个标准,后面aop ---tx 等等吧,让你可以xml文件中使用相应的标签比如
<aop:xxxx></aop:xxxx>就是个前缀,和jsp标签库类似.
xsi:schemaLocation后面这部分是告诉你前面所用的标签由哪个文件定义,xsd是xml的一种约束 -->
<!-- mvc用annotationを有効 --> <mvc:annotation-driven /> <!-- mvc用interceptorの設定 --> <mvc:interceptors> <!-- FUNCログ出力 --> <bean class="jp.co.cyber.interceptors.AccessLogInterceptors" /> </mvc:interceptors>
<!-- スケジュールの設定 --> <task:annotation-driven /> <!-- <bean class="jp.co.cyber.schedule.URstatusSchedule" init-method="init"/> <bean class="jp.co.cyber.schedule.URstatusService" /> -->
<!-- controllerクラスの初期化 --> <context:component-scan base-package="jp.co.cyber.controllers" />
<!-- serviceクラスの初期化 --> <context:component-scan base-package="jp.co.cyber.services" />
<!-- 異常画面へ遷移 --> <bean id="exceptionResolver" class="jp.co.cyber.ExceptionHandlers.MappingExceptionResolver"> <property name="defaultErrorView" value="error" /> <property name="exceptionMappings"> <props> </props> </property> </bean>
<!-- transactionの制御、メソッドに@Transactionalを追加すれば制御対象となる --> <tx:annotation-driven transaction-manager="transactionManager" />
<!-- mybatis连接 --> <bean class="org.mybatis.spring.annotation.MapperScannerPostProcessor"> <property name="basePackage" value="jp.co.cyber.db.dao" /> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mapperLocations" value="classpath*:jp/co/cyber/db/xml/*.xml" /> </bean>
<!-- 国際化 --> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames"> <list> <value>messages</value> <value>security_messages</value> </list> </property> </bean>
<!-- 数据源设定 --> <!-- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /> <property name="url" value="jdbc:sqlserver://ip:1433;DatabaseName=test1;" /> <property name="username" value="sa" /> <property name="password" value="test" /> <property name="initialSize" value="2" /> <property name="maxActive" value="5" /> <property name="maxWait" value="60000" /> <property name="removeAbandoned" value="true" /> <property name="removeAbandonedTimeout" value="300" /> <property name="logAbandoned" value="true" /> <property name="validationQuery"> <value>SELECT 1</value> </property> <property name="testOnBorrow"> <value>true</value> </property> </bean> --> <!-- 各helperの設定 --> <bean id="controlParameterHelper" class="jp.co.cyber.helpers.ControlParameterHelper" init-method="init" /> <bean id="selectOptionHelper" class="jp.co.cyber.helpers.SelectOptionHelper" init-method="init" /> <bean id="productHelper" class="jp.co.cyber.helpers.ProductHelper" init-method="init" /> <bean id="constantHelper" class="jp.co.cyber.helpers.ConstantHelper" init-method="init" /> <bean id="businessCategoryHelper" class="jp.co.cyber.helpers.BusinessCategoryHelper" init-method="init" /> <bean id="salesAgencyHelper" class="jp.co.cyber.helpers.SalesAgencyHelper" init-method="init" /> <bean id="sequenceHelper" class="jp.co.cyber.helpers.SequenceHelper" init-method="init" /> <bean id="statusNameHelper" class="jp.co.cyber.helpers.StatusNameHelper" init-method="init" /> <bean id="applicationProductHelper" class="jp.co.cyber.helpers.ApplicationProductHelper" init-method="init" /> <bean id="functionsHelper" class="jp.co.cyber.helpers.FunctionsHelper" init-method="init" />
<!-- application attribute --> <bean class="org.springframework.web.context.support.ServletContextAttributeExporter"> <property name="attributes"> <map> <entry key="Status"> <ref bean="statusNameHelper" /> </entry> <entry key="Constant"> <ref bean="constantHelper" /> </entry> <entry key="Functions"> <ref bean="functionsHelper" /> </entry> <entry key="Product"> <ref bean="productHelper" /> </entry> </map> </property> </bean> </beans>