Wildfly 获取数据源参数

Wildfly get datasource parameters

是否可以获取数据源参数的值,因为它们是在 standalone.xml 中配置的?即,我需要密码和用户名。

可以使用 jboss-cli 来做到这一点。给定示例数据源,您可以这样读取属性:

/subsystem=datasources/data-source=ExampleDS:read-attribute(name=user-name)

完整示例:

jboss-cli.bat

You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] embed-server
[standalone@embedded /] /subsystem=datasources/data-source=ExampleDS:read-attribute(name=user-name)
{
    "outcome" => "success",
    "result" => "sa"
}
[standalone@embedded /] /subsystem=datasources/data-source=ExampleDS:read-attribute(name=password)
{
    "outcome" => "success",
    "result" => "sa"
}

https://docs.jboss.org/author/display/WFLY8/CLI+Recipes

有一些例子