Wildfly获取数据源参数



是否可以获得数据源参数的值,就像它们在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+配方

最新更新