Configuration using XML

If you prefer an external, XML based configuration, i.e. because you migrate from WildFLy to WildFly Swarm, the you can leverage an existing standalone.xml file as well.

To make use of such a file, you’d need to bootstrap the Container with a reference to an XML configuration:

ClassLoader cl = Main.class.getClassLoader();
URL xmlConfig = cl.getResource("standalone.xml");

Swarm swarm = new Swarm(false)


In this case, you would still need to declare explicit maven dependencies on Swarm fractions, but the Container would just use those subsystem configurations for which a corresponding fraction can be found, i.e.:

<subsystem xmlns="urn:jboss:domain:datasources:4.0">
           <driver name="h2" module="com.h2database.h2">
       <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">