26.8. Seam コンポーネントとしての Spring Application Context
Spring
ContextLoaderListener を使ってアプリケーションの Spring ApplicationContext を起動することは可能ですが制約がいくつかあります。その制約とは、Spring ApplicationContext は SeamListener の後に起動させる必要があること、また Seam ユニットと統合テストで使用するために Spring ApplicationContext を起動することは複雑になる場合があることです。
これらの制約を克服するために Spring 統合には Spring
ApplicationContext を起動できる Seam コンポーネントが含まれています。 このコンポーネントを使用するには、 <spring:context-loader/> の定義を components.xml ファイルに配置します。 config-locations 属性で使用する Spring コンテキストファイルの場所を指定します。 複数の設定ファイルが必要な場合は、標準 components.xml の複数値のとおり、ネストした <spring:config-locations/> エレメントに配置することができます。
<components xmlns="http://jboss.com/products/seam/components"
xmlns:spring="http://jboss.com/products/seam/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/components
http://jboss.com/products/seam/components-2.2.xsd
http://jboss.com/products/seam/spring
http://jboss.com/products/seam/spring-2.2.xsd">
<spring:context-loader config-locations=
"/WEB-INF/applicationContext.xml"/>
</components>