このバージョンはまだ開発中であり、まだ安定しているとは見なされていません。最新の安定バージョンについては、Spring Integration 6.5.3 を使用してください! |
名前空間サポート
Spring Integration コンポーネントを、エンタープライズ統合の用語と概念に直接マップする XML 要素で構成できます。多くの場合、要素名はエンタープライズ統合パターン (英語) ブックの要素名と一致します。
Spring 構成ファイル内で Spring Integration のコア名前空間のサポートを有効にするには、最上位の 'beans' 要素に次の名前空間参照とスキーママッピングを追加します。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
https://www.springframework.org/schema/integration/spring-integration.xsd">(Spring Integration に特有の行を強調しました)
You can choose any name after xmlns:. We use int (short for Integration) for clarity, but you might prefer another abbreviation. On the other hand, if you use an XML editor or IDE support, the availability of auto-completion may convince you to keep the longer name for clarity. Alternatively, you can create configuration files that use the Spring Integration schema as the primary namespace, as the following example shows:
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
https://www.springframework.org/schema/integration/spring-integration.xsd">(Spring Integration に特有の行を強調しました)
この代替を使用する場合、Spring Integration 要素にプレフィックスは必要ありません。一方、同じ構成ファイル内で汎用 Spring Bean を定義する場合、Bean エレメントにはプレフィックス(<beans:bean …/>)が必要です。一般に、構成ファイル自体を(責任またはアーキテクチャーレイヤーに基づいて)モジュール化することをお勧めします。これらのファイル内ではジェネリクス Bean はほとんど必要ないため、統合に焦点を当てた構成ファイルで後者のアプローチを使用するのが適切であることがわかります。このドキュメントでは、統合ネームスペースがプライマリであると想定しています。
Spring Integration は、他の多くの名前空間を提供します。実際、名前空間のサポートを提供する各アダプター型(JMS、ファイルなど)は、個別のスキーマ内でその要素を定義します。これらの要素を使用するには、xmlns エントリと対応する schemaLocation マッピングで必要な名前空間を追加します。例: 次のルート要素は、これらの名前空間宣言のいくつかを示しています。
<?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:int="http://www.springframework.org/schema/integration"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
xmlns:int-ws="http://www.springframework.org/schema/integration/ws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
https://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file
https://www.springframework.org/schema/integration/file/spring-integration-file.xsd
http://www.springframework.org/schema/integration/jms
https://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
http://www.springframework.org/schema/integration/mail
https://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd
http://www.springframework.org/schema/integration/ws
https://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd">
...
</beans>このリファレンスマニュアルでは、対応する章のさまざまな要素の具体例を示します。ここで認識すべき主なことは、各名前空間 URI とスキーマの場所の命名の一貫性です。