5.13. WildFly 設定ファイルを使用するようクライアントを移行

EJB や naming などの JBoss EAP クライアントライブラリーは、リリース 7.1 まで異なる設定ストラテジーを使用していました。サーバー設定と似た方法で、すべてのクライアント設定を 1 つの設定ファイルに統合するため、JBoss EAP 7.1 には wildfly-config.xml ファイルが導入されました。

たとえば JBoss EAP 7.1 以前では、Java EJB クライアントの新しい InitialContext の作成には、jboss-ejb-client.properties ファイルを使用するか、Properties クラスを使用してプログラミングでプロパティーファイルを設定しました。

例: jboss-ejb-client.properties プロパティーファイル

remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=one
remote.connection.one.port=8080
remote.connection.one.host=127.0.0.1
remote.connection.one.username=quickuser
remote.connection.one.password=quick-123

JBoss EAP 7.1 以上では、クライアントアーカイブの META-INF/ ディレクトリーに wildfly-config.xml ファイルを作成します。これは、wildfly-config.xml ファイルを使用した設定と同等です。

例: wildfly-config.xml ファイルを使用した同等の設定

<configuration>
    <authentication-client xmlns="urn:elytron:client:1.2">
        <authentication-rules>
            <rule use-configuration="ejb"/>
        </authentication-rules>
        <authentication-configurations>
            <configuration name="ejb">
                <set-user-name name="quickuser"/>
                <credentials>
                    <clear-password password="quick-123"/>
                </credentials>
            </configuration>
        </authentication-configurations>
    </authentication-client>
    <jboss-ejb-client xmlns="urn:jboss:wildfly-client-ejb:3.0">
        <connections>
            <connection uri="remote+http://127.0.0.1:8080" />
        </connections>
    </jboss-ejb-client>
</configuration>

wildfly-config.xml ファイルを使用して Elytron クライアントに対してクライアント認証を設定する方法については、JBoss EAP『How to Configure Identity Management』の「Configure Client Authentication with Elytron Client」を参照してください。

wildfly-config.xml ファイルを使用して実行できるクライアント設定の種類に関する詳細は、JBoss EAP『開発ガイド』の「wildfly-config.xml ファイルを使用したクライアント設定」参照してください。