Chapter 1. Springing into action
Listing 1.1. Spring doesn’t make any unreasonable demands on HelloWorldBean.
Listing 1.2. A DamselRescuingKnight can only embark on RescueDamselQuests.
Listing 1.3. A BraveKnight is flexible enough to take on any Quest he’s given.
Listing 1.4. To test BraveKnight, inject it with a mock Quest.
Listing 1.5. SlayDragonQuest is a Quest to be injected into BraveKnight
Listing 1.6. Injecting a SlayDragonQuest into a BraveKnight with Spring
Listing 1.7. Spring offers Java-based configuration as an alternative to XML.
Listing 1.8. KnightMain.java loads the Spring context containing a Knight.
Listing 1.9. A Minstrel is a musically inclined logging system from medieval times.
Listing 1.10. A BraveKnight that must call Minstrel methods
Listing 1.11. Declaring the Minstrel as an aspect
Listing 1.12. Many Java APIs, such as JDBC, involve writing boilerplate code.
Listing 1.13. Templates let your code focus on the task at hand.
Chapter 2. Wiring beans
Listing 2.1. The CompactDisc interface defines the concept of a CD in Java.
Listing 2.2. @CompactDisc-annotated SgtPeppers implements CompactDisc
Listing 2.3. @ComponentScan enables component scanning
Listing 2.4. Enabling component scanning in XML
Listing 2.5. Testing that a CompactDisc was found by component scanning
Listing 2.6. Injecting a CompactDisc into a CDPlayer bean using autowiring
Chapter 3. Advanced wiring
Listing 3.1. The @Profile annotation wires beans based on active files