| Contents at a Glance | 4 |
---|
| Contents | 5 |
---|
| Introduction | 11 |
---|
| Who This Book Is For | 11 |
| How This Book Is Structured | 12 |
| Prerequisites | 12 |
| Downloading the Code | 13 |
| CHAPTER 1 A Gentle Introduction to the Spring Framework | 14 |
---|
| Building a Business Application | 14 |
| Java Platform Hurdles | 15 |
| Enter the Spring Framework | 15 |
| Introducing the Spring Framework Modules | 15 |
| Introducing the Sample Application | 17 |
| Managing Dependencies in Applications | 18 |
| A Use Case That Has Dependencies | 18 |
| Dealing with the Dependencies in Plain Java | 22 |
| Looking Up Dependencies with JNDI | 24 |
| Using the Spring Framework to Provide Dependencies | 25 |
| Integrating the Spring Framework with Java EE | 32 |
| Spring Framework Integration with Java EE Technologies | 32 |
| Spring and EJB | 33 |
| Setting Up the Spring Framework in Your Applications | 34 |
| Summary | 35 |
| CHAPTER 2 The Core Container | 36 |
---|
| How Do Factories Work? | 36 |
| Factory Methods | 37 |
| Factory Objects | 37 |
| Introducing the BeanFactory | 38 |
| Creating a BeanFactory Object | 39 |
| Using Dependency Lookup | 40 |
| Using Dependency Injection | 40 |
| Using XML Tags for Bean Configuration | 53 |
| Examining the Bean Life Cycle | 56 |
| Bean Scope: Singleton or Prototype | 56 |
| Bean Initialization | 61 |
| Bean Destruction | 64 |
| Using Factory Methods and Factory Objects in the Container | 67 |
| Implementing Factory Methods | 67 |
| Implementing Factory Objects | 69 |
| Implementing Factory Objects with the FactoryBean Interface | 70 |
| Introducing the ApplicationContext | 71 |
| Representing Resources | 71 |
| Creating ApplicationContext Objects | 72 |
| Configuring the Container with Spring 2.0 XML Tags | 75 |
| Using the Container As a Deployment Model | 76 |
| Summary | 76 |
| CHAPTER 3 Aspect-Oriented Programming | 77 |
---|
| Extending Applications the Traditional Way | 77 |
| Extending a Base Class | 78 |
| Using the Observer Design Pattern | 79 |
| Using the Decorator Design Pattern | 81 |
| Benefits of Separating Concerns | 84 |
| Limitations of Object-Oriented Solutions | 85 |
| Enter AOP | 85 |
| The Classic Spring AOP Framework | 86 |
| Implementing Cross-Cutting Concerns | 86 |
| Configuring AOP in the Spring Container | 87 |
| Using Proxy Objects | 88 |
| Filtering Methods | 89 |
| Selecting Advice Types | 92 |
| AOP Usage in the Spring Framework | 99 |
| Other Advice Classes | 99 |
| Logging Messages with Around Advice | 99 |
| Debugging with Around Advice | 100 |
| Limiting Concurrent Method Execution with Around Advice | 100 |
| Summary | 101 |
| CHAPTER 4 Spring AOP 2.0 | 102 |
---|
| Introducing AspectJ and Aspects | 102 |
| Join Points and Pointcuts in AspectJ | 103 |
| AspectJ Aspect Creation | 104 |
| Configuring @AspectJ-Style Aspects in Spring | 105 |
| A Simple @AspectJ-Style Aspect | 105 |
| @AspectJ-Style Advice Types | 109 |
| Pointcut Declaration and Reuse | 113 |
| Auto-Proxy Creation in the Spring Container | 114 |
| Advice and Aspect Ordering | 115 |
| Using AOP XML Tags | 119 |
| AOP Configuration Tags | 119 |
| XML Aspect Configuration | 120 |
| Pointcut Declaration and Reuse with XML | 123 |
| Advice Declaration in XML | 124 |
| Advice Ordering in XML | 128 |
| Advisors with AspectJ Pointcuts | 128 |
| Proxy Type Selection in XML | 129 |
| Working with Pointcuts | 130 |
| Selecting Methods Directly | 131 |
| Selecting Methods via Classes, Packages, and Inheritance | 135 |
| Selecting Methods via Annotations | 136 |
| Binding Advice Arguments | 141 |
| Binding Method Argument Values | 143 |
| Binding Return Values | 144 |
| Binding Exceptions | 145 |
| Binding Annotations | 146 |
| Summary | 149 |
| CHAPTER 5 Introduction to Data Access | 150 |
---|
| Spring Integration with Data-Access Frameworks | 150 |
| The Challenges of Data Access | 151 |
| Effects of Data-Access Leakage | 152 |
| Database Resources | 155 |
| Exceptions Related to Data Access | 162 |
| Database Transactions | 163 |
| Abstractions | 164 |
| The Spring Solutions to Data Access | 165 |
| Managing Database Resources | 166 |
| Handling Data-Access Exceptions | 167 |
| Working with Database Transactions | 167 |
| Data-Access Leakage | 169 |
| Changing the Application | 169 |
| Abstractions for Data-Access Code | 170 |
| Using the Repository Adapter | 172 |
| The DataSource Interface and Connection Pools | 174 |
| Setting Up Connection Pools | 175 |
| Using Value Placeholders and Property Files | 176 |
| Summary | 177 |
| CHAPTER 6 Persistence with JDBC | 178 |
---|
| Defining the Data Layer | 178 |
| Using the JdbcTemplate Class | 180 |
| Using the JdbcDaoSupport Class | 183 |
| Working with Database Data | 184 |
| Using Callbacks | 187 |
| Using the RowMapper Interface | 188 |
| Using the PreparedStatementSetter Interface | 189 |
| Using Executable Query Objects | 190 |
| Using the MappingSqlQuery Class | 190 |
| Using the SqlUpdate Class | 192 |
| Using the StoredProcedure Class | 194 |
| Creating Batches | 195 |
| Working with LOBs | 196 |
| Using the NativeJdbcExtractor Interface | 197 |
| Introducing New Spring 2.0 Features | 199 |
| Using the SimpleJdbcTemplate Class | 199 |
| Performing JNDI Data Source Lookups | 200 |
| Summary | 201 |
| CHAPTER 7 Transaction Management | 202 |
---|
| Database Transactions | 202 |
| Transaction Management in Spring | 203 |
| Configuring Spring s Transaction Manager for JDBC | 205 |
| Conf
|