5.13. 将客户端迁移到使用 WildFly 配置文件


在发布 7.1 之前,JBoss EAP 客户端库(如 EJB 和命名)采用了不同的配置策略。JBoss EAP 7.1 引入了 wildfly-config.xml 文件,旨在将所有客户端配置统一到一个配置文件中,其方式与服务器配置处理方式类似。

例如,在 JBoss EAP 7.1 之前,您可以使用 jboss-ejb-client.properties 文件或通过利用 Properties 类以编程方式为 Java EJB 客户端创建新的 InitialContext。

示例: jboss-ejb-client.properties 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 身份管理时使用 Elytron 客户端 配置 客户端身份验证。

有关可以使用 wildfly-config.xml 文件实现的客户端配置类型的更多信息,请参阅 JBoss EAP 开发指南 中的使用 wildfly-config.xml 文件进行客户端配置。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部