Inner beans .............................................................................................54
Collections .............................................................................................54
Null and empty string values ...................................................................57
XML shortcut with the p-namespace ........................................................57
XML shortcut with the c-namespace ........................................................58
Compound property names ......................................................................59
Using depends-on ...........................................................................................59
Lazy-initialized beans .....................................................................................60
Autowiring collaborators .................................................................................61
Limitations and disadvantages of autowiring ............................................62
Excluding a bean from autowiring ...........................................................63
Method injection ............................................................................................63
Lookup method injection .........................................................................64
Arbitrary method replacement .................................................................66
4.5. Bean scopes .....................................................................................................67
The singleton scope ........................................................................................68
The prototype scope ........................................................................................69
Singleton beans with prototype-bean dependencies ...........................................70
Request, session, and global session scopes ......................................................70
Initial web configuration .........................................................................70
Request scope .........................................................................................71
Session scope .........................................................................................72
Global session scope ...............................................................................72
Scoped beans as dependencies .................................................................72
Custom scopes ...............................................................................................74
Creating a custom scope ..........................................................................75
Using a custom scope ..............................................................................75
4.6. Customizing the nature of a bean .......................................................................77
Lifecycle callbacks .........................................................................................77
Initialization callbacks ............................................................................77
Destruction callbacks ..............................................................................78
Default initialization and destroy methods ................................................79
Combining lifecycle mechanisms ............................................................80
Startup and shutdown callbacks ...............................................................80
Shutting down the Spring IoC container gracefully in non-web applications 82
ApplicationContextAware and BeanNameAware ..............................................83
Other Aware interfaces ...................................................................................84
4.7. Bean definition inheritance ...............................................................................86
4.8. Container Extension Points ...............................................................................87
Customizing beans using a BeanPostProcessor .................................................87
Example: Hello World, BeanPostProcessor-style ......................................89
Example: The RequiredAnnotationBeanPostProcessor ..............................90
Customizing configuration metadata with a BeanFactoryPostProcessor ..............90
Example: the PropertyPlaceholderConfigurer ...........................................91
Example: the PropertyOverrideConfigurer ...............................................93
Spring Framework
3.1 Reference Documentation iv