Chapter 4. Examples

The examples folder shows some of the simpler uses of the MicroContainer. Each example is in a subfolder with the following structure:

readme.txt - a short description of the example including the expected output
build.xml - the ant build script
src/resources/META-INF/jboss-beans.xml - the MicroContainer configuration for the example
src/main - the java source for the example

To run each example, simply:

> cd examples/<directory>
> ant

To run against the JBoss application server:

> <edit> build.properties {change to point at your jboss instance}
> cd examples/<directory>
> ant deploy
followed by
> ant undeploy
to remove the deployment

The JBoss Microcontainer uses any logging mechanism supported by org.jboss.logging. e.g. if you want to use log4j, add log4j.jar and a directory containing either a log4j.properties or log4j.xml to the classpath. The default distribution uses the "null" logging implementation, which is why the examples all use System.out.println().

This just skims the surface of the MicroContainer, showing the most common usecases. Other more complicated examples can be found in the tests (available from cvs).