Forewords |
|
xxvii | |
Introduction |
|
xxxi | |
Chapter 1 POJO Programming Model, Lightweight Containers, And Inversion Of Control |
|
1 | (16) |
|
|
2 | (6) |
|
Problems of the Old EJB Programming Model |
|
|
2 | (5) |
|
Benefits of the POJO Programming Model |
|
|
7 | (1) |
|
Lightweight Containers and Inversion of Control (IoC) |
|
|
8 | (2) |
|
|
8 | (1) |
|
Inversion of Control (IoC) |
|
|
9 | (1) |
|
|
10 | (2) |
|
|
11 | (1) |
|
|
11 | (1) |
|
Setter or Constructor Injection |
|
|
12 | (1) |
|
|
12 | (5) |
Chapter 2 Dependency Injection With Spring |
|
17 | (46) |
|
|
18 | (11) |
|
|
18 | (3) |
|
Configuring and Using the Container |
|
|
21 | (8) |
|
|
29 | (15) |
|
|
30 | (1) |
|
|
31 | (3) |
|
|
34 | (1) |
|
Dependency Resolution Process |
|
|
35 | (1) |
|
Overriding Bean Definitions |
|
|
36 | (2) |
|
Using the depends-on Attribute |
|
|
38 | (1) |
|
|
39 | (4) |
|
|
43 | (1) |
|
|
44 | (15) |
|
|
44 | (1) |
|
Bean Instantiation Methods |
|
|
45 | (3) |
|
|
48 | (3) |
|
|
51 | (1) |
|
|
52 | (2) |
|
|
54 | (2) |
|
|
56 | (3) |
|
|
59 | (4) |
Chapter 3 Building Web Applications Using Spring MVC |
|
63 | (40) |
|
Learning the Features and Benefits of Spring MVC |
|
|
64 | (1) |
|
Using the Dispatcher Servlet Mechanism |
|
|
65 | (3) |
|
|
66 | (1) |
|
Accessing Servlet Context |
|
|
67 | (1) |
|
Creating Your First Spring MVC Application |
|
|
68 | (3) |
|
Configuring Spring MVC with Annotations |
|
|
71 | (2) |
|
|
73 | (11) |
|
Configuring the Form Tag Library |
|
|
73 | (1) |
|
Understanding the Power of Binding |
|
|
74 | (1) |
|
|
74 | (1) |
|
|
75 | (1) |
|
|
76 | (1) |
|
Selecting from a Drop-Down |
|
|
77 | (1) |
|
Selecting with Radio Buttons |
|
|
78 | (1) |
|
Selecting with Checkboxes |
|
|
78 | (1) |
|
|
78 | (1) |
|
|
79 | (1) |
|
|
79 | (5) |
|
Exploiting the Power of Annotations |
|
|
84 | (2) |
|
|
84 | (1) |
|
|
84 | (1) |
|
|
84 | (1) |
|
|
85 | (1) |
|
|
85 | (1) |
|
|
85 | (1) |
|
|
85 | (1) |
|
|
86 | (4) |
|
|
90 | (3) |
|
|
93 | (2) |
|
Implementing Internationalization (i18n) |
|
|
95 | (2) |
|
|
97 | (3) |
|
|
100 | (3) |
Chapter 4 JDBC Data Access With Spring |
|
103 | (34) |
|
Problems with Using Vanilla JDBC |
|
|
104 | (1) |
|
Introducing Spring's JDBC Support |
|
|
105 | (9) |
|
Managing JDBC Connections |
|
|
105 | (7) |
|
|
108 | (2) |
|
Using a Connection-Pooled DataSource |
|
|
110 | (1) |
|
|
111 | (1) |
|
Configuring and Using Spring's JDBC Support |
|
|
112 | (2) |
|
Performing Data Access Operations with Spring |
|
|
114 | (14) |
|
|
114 | (3) |
|
Queries with Named Parameters |
|
|
117 | (1) |
|
Writing Queries Using the IN Clause |
|
|
118 | (1) |
|
Using PreparedStatements within JdbcTemplate |
|
|
119 | (2) |
|
Inserting, Updating, and Deleting Records |
|
|
121 | (3) |
|
Calling Stored Procedures and Stored Functions |
|
|
124 | (2) |
|
Performing Batch Operations |
|
|
126 | (1) |
|
Handling BLOB and CLOB Objects |
|
|
126 | (1) |
|
Accessing Vendor-Specific JDBC Methods |
|
|
127 | (1) |
|
|
127 | (1) |
|
Modeling JDBC Operations as Java Objects |
|
|
128 | (4) |
|
Encapsulating SQL Query Executions |
|
|
128 | (2) |
|
Encapsulating SQL DML Operations |
|
|
130 | (1) |
|
Encapsulating Stored Procedure Executions |
|
|
131 | (1) |
|
Exception Handling and Error Code Translation |
|
|
132 | (1) |
|
Common Data Access Exception Hierarchy |
|
|
132 | (1) |
|
Automatic Handling and Translation of SQLException |
|
|
132 | (1) |
|
|
133 | (4) |
Chapter 5 Data Access With JPA Using Spring |
|
137 | (38) |
|
Brief Introduction to ORM and JPA |
|
|
138 | (18) |
|
|
138 | (1) |
|
Building Blocks of an ORM Framework |
|
|
139 | (1) |
|
|
139 | (1) |
|
Mapping the Object Model to the Relational Model |
|
|
140 | (7) |
|
|
140 | (1) |
|
Mapping Attributes to Columns |
|
|
141 | (1) |
|
Creating Associations between Objects |
|
|
142 | (3) |
|
Mapping Java Types to SQL Types |
|
|
145 | (2) |
|
Configuring and Using JPA |
|
|
147 | (9) |
|
Performing CRUD Operations on Objects |
|
|
150 | (5) |
|
Querying with Object Query Language |
|
|
155 | (1) |
|
|
156 | (15) |
|
Setting Up JPA in Spring Container |
|
|
156 | (5) |
|
Implementing DAOs Based on Plain JPA |
|
|
161 | (5) |
|
Handling and Translating Exceptions |
|
|
166 | (1) |
|
Further JPA Configuration in Spring Environment |
|
|
167 | (13) |
|
|
168 | (1) |
|
|
168 | (1) |
|
JPA and Load Time Weaving |
|
|
169 | (1) |
|
Dealing with Multiple Persistence Units |
|
|
170 | (1) |
|
|
171 | (4) |
Chapter 6 Managing Transactions With Spring |
|
175 | (34) |
|
Understanding Transaction Management |
|
|
176 | (4) |
|
Spring's Transaction Abstraction Model |
|
|
180 | (3) |
|
Local versus Global Transactions |
|
|
182 | (1) |
|
PlatformTransactionManager Implementations |
|
|
182 | (1) |
|
Advantages of Spring's Abstract Transaction Model |
|
|
183 | (1) |
|
Declarative Transaction Management with Spring |
|
|
183 | (14) |
|
Isolating the Service Layer from Data Access Technology Details |
|
|
186 | (3) |
|
Customizing Default Transactional Behavior |
|
|
189 | (1) |
|
Using @Transactional on the Class Level |
|
|
190 | (1) |
|
Understanding Transaction Propagation Rules |
|
|
191 | (4) |
|
|
191 | (1) |
|
|
192 | (1) |
|
|
192 | (1) |
|
|
192 | (1) |
|
Propagation NOT_SUPPORTED |
|
|
192 | (1) |
|
|
193 | (1) |
|
|
193 | (2) |
|
Using <tx:advice> for Declarative Transaction Management |
|
|
195 | (2) |
|
Programmatic Transaction Management with Spring |
|
|
197 | (6) |
|
Using the PlatformTransactionManager Approach |
|
|
201 | (2) |
|
Executing Custom Logic Before or After Transactions |
|
|
203 | (2) |
|
Advising Transactional Operations |
|
|
203 | (1) |
|
Executing Logic after Transactions Using TransactionSynchronization |
|
|
204 | (1) |
|
|
205 | (4) |
Chapter 7 Test-Driven Development With Spring |
|
209 | (28) |
|
Configuring and Caching ApplicationContext |
|
|
210 | (7) |
|
Using XML- and Java-Based Context Configuration in Tests |
|
|
210 | (4) |
|
Configuring Context with ApplicationContextlnitializer |
|
|
214 | (1) |
|
Inheriting Context Configuration |
|
|
214 | (2) |
|
ApplicationContext Caching |
|
|
216 | (1) |
|
Injecting Dependencies of Test Fixtures |
|
|
217 | (2) |
|
Using Transaction Management in Tests |
|
|
219 | (3) |
|
|
222 | (9) |
|
Context Hierarchies in Tests |
|
|
225 | (1) |
|
Testing Request- and Session-Scoped Beans |
|
|
225 | (2) |
|
Testing Spring MVC Projects |
|
|
227 | (4) |
|
|
227 | (1) |
|
|
228 | (2) |
|
Testing Exception Handlers |
|
|
230 | (1) |
|
Printing Mock Request and Response |
|
|
231 | (1) |
|
Using Mock Objects and Other Utilities for Testing |
|
|
231 | (2) |
|
Spring Provided Mock Objects for Testing |
|
|
231 | (1) |
|
Other Utilities and Test Annotations |
|
|
232 | (1) |
|
|
233 | (4) |
Chapter 8 Aspect-Oriented Programming With Spring |
|
237 | (26) |
|
Getting Started with AOP with Spring |
|
|
239 | (4) |
|
Becoming Familiar with Types of Advices |
|
|
243 | (5) |
|
|
245 | (1) |
|
|
245 | (1) |
|
|
245 | (1) |
|
|
246 | (1) |
|
|
247 | (1) |
|
Defining Point-Cut Designators |
|
|
248 | (2) |
|
The Type Signature Expressions |
|
|
248 | (1) |
|
The Method Signature Expressions |
|
|
249 | (1) |
|
Other Alternative Point-Cut Designators |
|
|
249 | (1) |
|
|
250 | (1) |
|
Capitalizing on the Power of Annotations |
|
|
250 | (5) |
|
|
250 | (1) |
|
|
251 | (1) |
|
|
252 | (1) |
|
|
252 | (1) |
|
|
252 | (1) |
|
|
253 | (1) |
|
|
253 | (1) |
|
|
254 | (1) |
|
Blending AspectJ with Spring |
|
|
255 | (4) |
|
Configuring Spring AOP with Annotations |
|
|
259 | (1) |
|
|
259 | (4) |
Chapter 9 Spring Expression Language |
|
263 | (22) |
|
Configuring Applications with SpEL |
|
|
264 | (3) |
|
|
267 | (3) |
|
|
270 | (3) |
|
|
272 | (1) |
|
|
272 | (1) |
|
Working with Variables and Functions |
|
|
273 | (2) |
|
|
273 | (1) |
|
|
274 | (1) |
|
Accessing System Properties and Environment |
|
|
274 | (1) |
|
|
274 | (1) |
|
|
274 | (1) |
|
Understanding SpEL Operators |
|
|
275 | (5) |
|
|
276 | (1) |
|
|
276 | (1) |
|
|
276 | (1) |
|
|
277 | (1) |
|
Regular Expression Operator |
|
|
278 | (1) |
|
|
278 | (1) |
|
Collection Selection and Projection |
|
|
279 | (1) |
|
Selecting the First and Last Element of a Collection |
|
|
280 | (1) |
|
|
280 | (1) |
|
|
280 | (1) |
|
|
281 | (1) |
|
|
281 | (1) |
|
|
281 | (4) |
Chapter 10 Caching |
|
285 | (20) |
|
Building Your First Caching Application |
|
|
286 | (4) |
|
Configuring the Cache Manager with a Different Name |
|
|
289 | (1) |
|
Configuring the Caching Abstraction with Annotations |
|
|
289 | (1) |
|
Working with Cache Annotations |
|
|
290 | (3) |
|
|
290 | (2) |
|
|
291 | (1) |
|
|
291 | (1) |
|
|
292 | (1) |
|
|
292 | (1) |
|
|
293 | (1) |
|
Implementing Cache Managers |
|
|
293 | (2) |
|
|
293 | (1) |
|
|
294 | (1) |
|
ConcurrentMapCacheManager |
|
|
294 | (1) |
|
|
294 | (1) |
|
Casting Your SpEL on Caches |
|
|
295 | (1) |
|
Initializing Your Caches Programmatically |
|
|
296 | (2) |
|
Finding Alternative Cache Providers |
|
|
298 | (5) |
|
|
299 | (3) |
|
|
302 | (1) |
|
|
302 | (1) |
|
|
303 | (2) |
Chapter 11 Restful Web Services With Spring |
|
305 | (26) |
|
Creating Your First REST Web Service |
|
|
306 | (12) |
|
Returning Different HTTP Status Codes from REST Web Service |
|
|
318 | (1) |
|
Learning an Annotation-Based Configuration Alternative |
|
|
318 | (2) |
|
Using REST Web Services with XML |
|
|
320 | (2) |
|
Using the Exception Handling Mechanism |
|
|
322 | (4) |
|
Unit Testing RESTful Services |
|
|
326 | (2) |
|
|
328 | (3) |
Chapter 12 Securing Web Applications With Spring Security |
|
331 | (38) |
|
|
332 | (1) |
|
Features of Spring Security |
|
|
333 | (1) |
|
Configuring and Using Spring Security |
|
|
334 | (6) |
|
Understanding the Fundamental Building Blocks of Spring Security |
|
|
340 | (1) |
|
|
341 | (12) |
|
|
342 | (1) |
|
|
342 | (2) |
|
|
344 | (1) |
|
Customizing the Login Page |
|
|
344 | (2) |
|
|
346 | (1) |
|
Accessing UserDetails Using JDBC |
|
|
346 | (3) |
|
|
349 | (1) |
|
|
350 | (1) |
|
|
351 | (1) |
|
|
352 | (1) |
|
Authorizing Web Requests and Service Method Calls |
|
|
353 | (11) |
|
|
353 | (2) |
|
How Does Authorization Work? |
|
|
355 | (2) |
|
Expression-Based Authorization |
|
|
357 | (1) |
|
|
358 | (1) |
|
|
359 | (1) |
|
|
359 | (1) |
|
Authorizing Service Methods |
|
|
359 | (5) |
|
|
364 | (5) |
Chapter 13 Next Stop: Spring 4.0 |
|
369 | (16) |
|
Keeping Up with the Latest: Java 8 and Java EE7 Support |
|
|
370 | (4) |
|
|
370 | (11) |
|
|
373 | (1) |
|
Bean Validation Integration |
|
|
374 | (1) |
|
JSR 310: Date Time Value Type Support |
|
|
374 | (1) |
|
Configuring Injection with Conditional Dependency |
|
|
374 | (3) |
|
Ordering the Elements of Autowired Collections |
|
|
377 | (2) |
|
|
379 | (2) |
|
Introducing New Annotations |
|
|
381 | (1) |
|
Documenting with @Description |
|
|
381 | (1) |
|
Using the @RestController Annotation |
|
|
382 | (1) |
|
|
382 | (3) |
Appendix: Solutions To Exercises |
|
385 | (40) |
|
|
385 | (3) |
|
|
388 | (5) |
|
|
393 | (1) |
|
|
393 | (6) |
|
|
399 | (4) |
|
|
403 | (3) |
|
|
406 | (3) |
|
|
409 | (2) |
|
|
411 | (3) |
|
|
414 | (3) |
|
|
417 | (3) |
|
|
420 | (3) |
|
|
423 | (2) |
Index |
|
425 | |