Documenting Your
MVC Application
As your applications grow larger and more complex, the XML files used to define your beans
can become more difficult to maintain, especially in multidiscipline teams where different
people maintain the context files for different parts of the application. Documenting your
application is as important as documenting your source code, and with Spring applications,
that means documenting your context files.
BeanDoc
BeanDoc (http://opensource2.atlassian.com/confluence/spring/display/BDOC/Home) is an
official Spring subproject, and it can help by producing a similar kind of documentation for
your Spring beans that Javadoc produces for your Java classes. Beans that are wired together
are cross-linked, their class names can be linked to the relevant Javadoc pages, and many
disparate XML files can be managed and viewed as a logical application context. Beans are
documented with their descriptions and class names (linked to Javadoc locations) and linked
to their dependencies (references, parent-beans, lookup-methods). Best of all, in association
with the open-source tool Graphviz (http://www.graphviz.org) you can visualize your appli-
cation contexts as graphs.
Although BeanDoc is still early release software (version 0.7.0 was current at the time of
writing) it should be stable enough for everyday use. It is highly configurable and skinnable in
terms of its output and designed for extensibility if the basic functionality doesn’t meet your
needs. BeanDoc can be operated from the command line, programmatically, or via its own
Ant task. Figure A-1 shows a sample of BeanDoc’s output (based on the Spring JPetStore sam-
ple application).
371
APPENDIX A
■ ■ ■
584X_Ch13_AppA_FINAL 1/30/06 1:13 PM Page 371