Spring JavaConfig Reference Guide


Rod Johnson, Costin Leau, Chris Beams


Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.

About this document
1. Document structure
2. Target audience
3. Code conventions
Preface to the third milestone release
I. Introduction
1. Overview
1.1. What is JavaConfig?
1.2. Why JavaConfig?
1.3. Requirements
1.3.1. Runtime Environment
1.3.2. Project Dependencies
1.4. History
2. New & Noteworthy in 1.0.0.m3
2.1. AnnotationApplicationContext deprecated
2.2. Type-safety improvements
2.3. First-class support for JavaConfig in the web tier
2.4. New semantics for nested @Configuration classes
2.5. Modularization improvements with @Import
2.6. Support for externalizing string values with @ExternalValue
3. Quick start
3.1. Download JavaConfig
3.1.1. Manual download
3.1.2. Maven 2
3.2. Create bean definitions
3.3. Retrieve bean instances
3.4. Summary
II. API Reference
4. Creating and using bean definitions
4.1. @Configuration
4.2. @Bean
4.2.1. Declaring a bean
4.2.2. Using *Aware interfaces
4.2.3. Bean visibility
4.2.4. Bean scoping Using @Bean's scope attribute @ScopedProxy Method injection
4.2.5. Bean naming
4.3. JavaConfigApplicationContext
4.3.1. Construction Options Construction by class literal Construction by base package Post-construction configuration
4.3.2. Accessing beans with getBean() Type-safe access String-based access
5. Modularizing configurations
5.1. Partitioning bean definitions across multiple @Configuration classes
5.2. Referencing externally defined beans with @ExternalBean
5.3. Importing @Configuration classes with @Import
5.4. ConfigurationSupport
5.5. Externalizing values with @ExternalValue and @ResourceBundles
5.6. Nesting @Configuration classes
6. Using aspects
6.1. Embedded aspects
6.2. Reusable aspects
7. Developing web applications with JavaConfig
7.1. JavaConfigWebApplicationContext
8. Combining configuration approaches
8.1. JavaConfig and XML
8.1.1. Bootstrapping JavaConfig from XML with ConfigurationPostProcessor Configuring configurations
III. Appendices
A. Roadmap
B. Visualizing configurations with Spring IDE
C. Maven2 POM configurations
C.1. Minimal
C.2. AOP
D. Additional resources
D.1. Core Spring documentation
D.2. Community forums
D.3. Issue tracking
D.4. SpringSource team blog
D.5. Consulting and training services