Craig Walls, Ryan Breidenbach9781932394351, 1-932394-35-4
Table of contents :
preface……Page 17
acknowledgments……Page 20
Roadmap……Page 23
Code conventions and downloads……Page 25
About the title……Page 26
About the cover illustration……Page 27
Part 1 – Spring essentials……Page 29
A Spring jump start……Page 31
1.1.1 A day in the life of a J2EE developer……Page 33
1.1.2 Spring’s pledge……Page 34
1.2 What is Spring?……Page 36
1.2.1 Spring modules……Page 37
1.3 Spring jump start……Page 40
1.4 Understanding inversion of control……Page 43
1.4.2 IoC in action……Page 44
1.4.3 IoC in enterprise applications……Page 51
1.5.1 Introducing AOP……Page 53
1.5.2 AOP in action……Page 55
1.5.3 AOP in the enterprise……Page 58
1.6.1 Comparing Spring to EJB……Page 61
1.6.2 Considering other lightweight containers……Page 64
1.6.3 Web frameworks……Page 66
1.7 Summary……Page 68
Wiring beans……Page 70
2.1.1 Introducing the BeanFactory……Page 72
2.1.2 Working with an application context……Page 74
2.1.3 A bean’s life……Page 75
2.2 Basic wiring……Page 78
2.2.1 Wiring with XML……Page 82
2.2.2 Adding a bean……Page 83
2.2.3 Injecting dependencies via setter methods……Page 86
2.2.4 Injecting dependencies via constructor……Page 93
2.3 Autowiring……Page 97
2.3.1 Handling ambiguities of autowiring……Page 99
2.3.4 To autowire or not to autowire……Page 100
2.4 Working with Spring’s special beans……Page 101
2.4.1 Postprocessing beans……Page 102
2.4.2 Postprocessing the bean factory……Page 104
2.4.3 Externalizing the configuration……Page 106
2.4.4 Customizing property editors……Page 108
2.4.5 Resolving text messages……Page 111
2.4.6 Listening for events……Page 113
2.4.7 Publishing events……Page 114
2.4.8 Making beans aware……Page 115
2.5 Summary……Page 118
Creating aspects……Page 119
3.1 Introducing AOP……Page 120
3.1.1 Defining AOP terminology……Page 121
3.1.2 Spring’s AOP implementation……Page 123
3.2 Creating advice……Page 125
3.2.1 Before advice……Page 127
3.2.2 After advice……Page 129
3.2.3 Around advice……Page 130
3.2.4 Throws advice……Page 132
3.3.1 Defining a pointcut in Spring……Page 133
3.3.3 Using Spring’s static pointcuts……Page 135
3.3.4 Using dynamic pointcuts……Page 139
3.3.5 Pointcut operations……Page 141
3.4.1 Implementing IntroductionInterceptor……Page 143
3.4.2 Creating an IntroductionAdvisor……Page 147
3.4.3 Using introduction advice carefully……Page 148
3.5 Using ProxyFactoryBean……Page 150
3.6.1 BeanNameAutoProxyCreator……Page 152
3.6.2 DefaultAdvisorAutoProxyCreator……Page 154
3.7 Summary……Page 156
Part 2 – Spring in the business layer……Page 159
Hitting the database……Page 161
4.1 Learning Spring’s DAO philosophy……Page 162
4.1.1 Understanding Spring’s DataAccessException……Page 163
4.1.2 Working with DataSources……Page 165
4.1.3 Consistent DAO support……Page 167
4.2 Using JDBC with Spring……Page 169
4.2.1 The problem with JDBC code……Page 170
4.2.2 Using JdbcTemplate……Page 172
4.2.3 Creating operations as objects……Page 180
4.2.4 Auto-incrementing keys……Page 183
4.3 Introducing Spring’s ORM framework support……Page 184
4.4.1 Hibernate overview……Page 185
4.4.2 Managing Hibernate resources……Page 187
4.4.3 Accessing Hibernate through HibernateTemplate……Page 190
4.4.4 Subclassing HibernateDaoSupport……Page 191
4.5.1 Configuring JDO……Page 192
4.5.2 Accessing data with JdoTemplate……Page 193
4.6 Spring and iBATIS……Page 194
4.6.1 Setting up SQL Maps……Page 195
4.6.2 Using SqlMapClientTemplate……Page 196
4.7.1 Setting up OJB’s PersistenceBroker……Page 197
4.8 Summary……Page 199
Managing transactions……Page 201
5.1 Understanding transactions……Page 202
5.1.1 Explaining transactions in only four words……Page 204
5.1.2 Understanding Spring’s transaction management support……Page 205
5.1.3 Introducing Spring’s transaction manager……Page 206
5.2 Programming transactions in Spring……Page 209
5.3 Declaring transactions……Page 211
5.3.1 Understanding transaction attributes……Page 213
5.3.2 Declaring a simple transaction policy……Page 217
5.4.1 Using NameMatchTransactionAttributeSource……Page 219
5.4.2 Shortcutting name-matched transactions……Page 222
5.5 Declaring transactions with metadata……Page 223
5.5.1 Sourcing transaction attributes from metadata……Page 224
5.5.2 Declaring transactions with Commons Attributes……Page 225
5.6 Trimming down transaction declarations……Page 229
5.6.1 Inheriting from a parent TransactionProxyFactoryBean……Page 230
5.6.2 Autoproxying transactions……Page 231
5.7 Summary……Page 234
Remoting……Page 235
6.1 Spring remoting overview……Page 236
6.2.1 Wiring RMI services……Page 240
6.2.2 Exporting RMI services……Page 242
6.3 Remoting with Hessian and Burlap……Page 246
6.3.1 Accessing Hessian/Burlap services……Page 247
6.3.2 Exposing bean functionality with Hessian/Burlap……Page 248
6.4 Using Http invoker……Page 251
6.4.1 Accessing services via HTTP……Page 252
6.4.2 Exposing beans as HTTP Services……Page 253
6.5 Working with EJBs……Page 254
6.5.1 Accessing EJBs……Page 255
6.5.2 Developing Spring-enabled EJBs……Page 259
6.6 Using JAX-RPC web services……Page 261
6.6.1 Referencing a web service with JAX-RPC……Page 262
6.6.2 Wiring a web service in Spring……Page 264
6.7 Summary……Page 266
Accessing enterprise services……Page 268
7.1.1 Working with conventional JNDI……Page 269
7.1.2 Proxying JNDI objects……Page 271
7.2 Sending e-mail……Page 272
7.3.1 Scheduling with Java’s Timer……Page 276
7.3.2 Using the Quartz scheduler……Page 278
7.3.3 Invoking methods on a schedule……Page 282
7.4 Sending messages with JMS……Page 284
7.4.1 Sending messages with JMS templates……Page 285
7.4.2 Consuming messages……Page 289
7.4.3 Converting messages……Page 291
7.5 Summary……Page 294
Part 3 – Spring in the web layer……Page 295
Building the web layer……Page 297
8.1 Getting started with Spring MVC……Page 298
8.1.1 A day in the life of a request……Page 299
8.1.2 Configuring DispatcherServlet……Page 300
8.1.3 Spring MVC in a nutshell……Page 303
8.2 Mapping requests to controllers……Page 307
8.2.1 Mapping URLs to bean names……Page 308
8.2.3 Using metadata to map controllers……Page 309
8.2.4 Working with multiple handler mappings……Page 310
8.3 Handling requests with controllers……Page 311
8.3.1 Writing a simple controller……Page 313
8.3.2 Processing commands……Page 315
8.3.3 Processing form submissions……Page 317
8.3.4 Processing complex forms with wizards……Page 322
8.3.5 Handling multiple actions in one controller……Page 329
8.3.6 Working with Throwaway controllers……Page 333
8.4 Resolving views……Page 335
8.4.1 Using template views……Page 336
8.4.2 Resolving view beans……Page 338
8.4.3 Choosing a view resolver……Page 341
8.5 Using Spring’s bind tag……Page 342
8.7 Summary……Page 345
View layer alternatives……Page 347
9.1.1 Defining the Velocity view……Page 349
9.1.2 Configuring the Velocity engine……Page 350
9.1.3 Resolving Velocity views……Page 351
9.1.4 Formatting dates and numbers……Page 352
9.1.5 Exposing request and session attributes……Page 353
9.1.6 Binding form fields in Velocity……Page 354
9.2 Working with FreeMarker……Page 355
9.2.1 Constructing a FreeMarker view……Page 356
9.2.2 Configuring the FreeMarker engine……Page 357
9.2.4 Binding form fields in FreeMarker……Page 358
9.3.1 Tile views……Page 360
9.3.2 Tile controllers……Page 363
9.4 Generating non-HTML output……Page 365
9.4.1 Producing Excel spreadsheets……Page 366
9.4.2 Generating PDF documents……Page 368
9.4.3 Generating other non-HTML files……Page 371
9.5 Summary……Page 372
Working with other web frameworks……Page 374
10.1 Working with Jakarta Struts……Page 375
10.1.2 Implementing Spring-aware Struts actions……Page 376
10.1.3 Delegating actions……Page 378
10.2 Working with Tapestry……Page 380
10.2.1 Replacing the Tapestry Engine……Page 381
10.2.2 Loading Spring beans into Tapestry pages……Page 383
10.3.1 Resolving variables……Page 385
10.3.2 Publishing request handled events……Page 389
10.4 Integrating with WebWork……Page 390
10.4.1 WebWork 1……Page 391
10.4.2 XWork/WebWork2……Page 392
10.5 Summary……Page 393
Securing Spring applications……Page 395
11.1 Introducing the Acegi Security System……Page 396
11.1.1 Security interceptors……Page 397
11.1.4 Run-as managers……Page 398
11.2.1 Configuring a provider manager……Page 399
11.2.2 Authenticating against a database……Page 401
11.2.3 Authenticating against an LDAP repository……Page 410
11.2.4 Enabling Single Sign-On with Acegi and Yale CAS……Page 412
11.3.1 Voting access decisions……Page 417
11.3.2 Deciding how to vote……Page 418
11.4 Securing web applications……Page 420
11.4.1 Proxying Acegi’s filters……Page 422
11.4.2 Enforcing web security……Page 425
11.4.3 Processing a login……Page 428
11.4.4 Setting up the security context……Page 434
11.4.5 Ensuring a secure channel……Page 435
11.4.6 Using the Acegi tag library……Page 439
11.5.1 Creating a security aspect……Page 440
11.5.2 Securing methods using metadata……Page 442
11.6 Summary……Page 444
Spring setup……Page 445
A.2 Choosing a distribution……Page 446
A.3 Setting up your project……Page 447
A.4 Building with Ant……Page 448
Spring-related projects……Page 450
B.1 AppFuse……Page 451
B.3 Spring.NET……Page 452
A……Page 455
C……Page 457
D……Page 459
F……Page 460
H……Page 461
J……Page 462
L……Page 464
N……Page 465
P……Page 466
R……Page 467
S……Page 468
T……Page 470
V……Page 471
Y……Page 472
Reviews
There are no reviews yet.