7.13. WildFly 設定ファイルを使用するようクライアントを移行
JBoss EAP 7.1 のリリース前は、Enterprise Java Beans や命名などの JBoss EAP クライアントライブラリーは、異なる設定ストラテジーを使用していました。サーバー設定と似た方法で、すべてのクライアント設定を 1 つの設定ファイルに統合するため、JBoss EAP 7.1 には wildfly-config.xml ファイルが導入されました。
たとえば、JBoss EAP 7.1 より前では、jboss-ejb-client.properties ファイルを使用するか、Properties クラスを使用してプログラムでプロパティーを設定することによって、Enterprise Java Beans クライアントの新しい InitialContext を作成することがありました。
例: 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.7">
<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.2">
<connections>
<connection uri="remote+http://127.0.0.1:8080" />
</connections>
</jboss-ejb-client>
</configuration>