There is the possibility to overwrite the DS config with environment.
For test environment it looks like a simple way to switch datasources on
startup without editing the configuration.
See community :
https://community.jboss.org/message/730156
All attributes are possible but the driver will fail:
===> not given by -D
13:38:23,146 ERROR [org.jboss.as.controller.management-operation]
(ServerService Thread Pool -- 27) Operation ("enable") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "ExampleDS")
]) - failure description: "JBAS014802: Cannot resolve expression
'expression \"${test.db.driver}\"' -- java.lang.IllegalStateException:
Failed to resolve expression: ${test.db.driver}"
===> given by -Dtest.db.driver=h2
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.${test_db_driver} (missing) dependents:
[service jboss.data-source.java:jboss/datasources/ExampleDS]
Looks like that the dependency is checked before replacing the environment.
This sounds to me that it should possible to use the expression for the
driver attribute.
What the behaviour should be? Accept expression or deny it with a
correct message?
Wolf