JBoss.org Community Documentation

Chapter 9. Configuring POJOs

9.1. Using annotations
9.2. Writing deployment descriptors
9.3. Using JavaBean XML
9.4. Using Spring XML
9.5. Using Java Properties

In accordance with modern development methods JBoss Microcontainer supports POJO configuration via annotations and/or deployment descriptors. The decision to use one or the other depends on what you are trying to achieve. If there is a sensible default configuration for your POJOs then it may be worthwhile defining this using annotations so that users do not have to maintain a separate deployment descriptor. Since annotations are overriden by deployment descriptors at runtime it is always possible for users to change the default configuration using a descriptor if necessary.


Annotations are overriden by deployment descriptors at runtime.

If there is no sensible default configuration then it may be worthwhile using a deployment descriptor instead of annotations. This keeps the source code free of potentially redundant information and allows for easy customization since the initial deployment descriptor acts as a template for further changes.

Sometimes a mixture of annotations and a deployment descriptor is best. It's up to you to discover what makes most sense for your particular situation.