Springの設定ファイル

SpringフレームワークでapplicationContext.xmlの中身がよくわからなかったので調査結果を記載する。

とりあえずSpring2.5系で調査。3.0系以降は資料が少ない・・・

備忘録なので、詳細な設定までは踏み込まない。

通常使われているapplicationContextの内容が理解できるようにするのが目的。

属性の*は必須を表す。

大体こんな感じのapplicationContext.xmlの意味を調べる。

<?xml version="1.0" encoding="UTF-8"?>
<beans default-autowire="byName"
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-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">
    <!-- DB定義 -->
    <import resource="classpath:config/dao/dao.xml" />
    <!-- その他定義 -->
    <import resource="classpath:config/aspect.xml" />
    <context:annotation-config />
    <!-- autowire定義 -->
    <context:component-scan base-package="jp.hoge.huga">
        <context:include-filter type="regex" expression=".*Service$" />
    </context:component-scan>
</beans>

基本情報(beans名前空間)についてのリファレンス

context名前空間についてのリファレンス

aop名前空間についてのリファレンス