Spring in Action / Edition 4

Spring in Action / Edition 4

by Craig Walls
ISBN-10:
161729120X
ISBN-13:
9781617291203
Pub. Date:
12/01/2014
Publisher:
Manning Publications Company
Select a Purchase Option (Fourth Edition)
  • purchase options
    $34.66 $49.99 Save 31% Current price is $34.66, Original price is $49.99. You Save 31%.
  • purchase options

Overview

Spring in Action / Edition 4

Spring is a fresh breeze blowing over the Java landscape. Based on a design principle called Inversion of Control, Spring is a powerful but lightweight J2EE framework that does not require the use of EJBs. Spring greatly reduces the complexity of using interfaces, and speeds and simplifies your application development. You get the power and robust features of EJB and get to keep the simplicity of the non-enterprise JavaBean.

Spring in Action introduces you to the ideas behind Spring and then quickly launches into a hands-on exploration of the framework. Combining short code snippets and an ongoing example developed throughout the book, it shows you how to build simple and efficient J2EE applications. You will see how to solve persistence problems using the leading open-source tools, and also how to integrate your application with the most popular web frameworks. You will learn how to use Spring to manage the bulk of your infrastructure code so you can focus on what really matters-your critical business needs.

Product Details

ISBN-13: 9781617291203
Publisher: Manning Publications Company
Publication date: 12/01/2014
Edition description: Fourth Edition
Pages: 624
Sales rank: 319,416
Product dimensions: 7.30(w) x 9.10(h) x 1.40(d)

Table of Contents

Prefacexvii
Acknowledgmentsxx
About this bookxxiii
Part 1Spring essentials1
1A Spring jump start3
1.1Why Spring?5
A day in the life of a J2EE developer5
Spring's pledge6
1.2What is Spring?8
Spring modules9
1.3Spring jump start12
1.4Understanding inversion of control15
Injecting dependencies16
IoC in action16
IoC in enterprise applications23
1.5Applying aspect-oriented programming25
Introducing AOP25
AOP in action27
AOP in the enterprise30
1.6Spring alternatives33
Comparing Spring to EJB33
Considering other lightweight containers36
Web frameworks38
Persistence frameworks40
1.7Summary40
2Wiring beans42
2.1Containing your beans44
Introducing the BeanFactory44
Working with an application context46
A bean's life47
2.2Basic wiring50
Wiring with XML54
Adding a bean55
Injecting dependencies via setter methods58
Injecting dependencies via constructor65
2.3Autowiring69
Handling ambiguities of autowiring71
Mixing auto and explicit wiring72
Autowiring by default72
To autowire or not to autowire72
2.4Working with Spring's special beans73
Postprocessing beans74
Postprocessing the bean factory76
Externalizing the configuration78
Customizing property editors80
Resolving text messages83
Listening for events85
Publishing events86
Making beans aware87
2.5Summary90
3Creating aspects91
3.1Introducing AOP92
Defining AOP terminology93
Spring's AOP implementation95
3.2Creating advice97
Before advice99
After advice101
Around advice102
Throws advice104
Introduction advice105
3.3Defining pointcuts105
Defining a pointcut in Spring105
Understanding advisors107
Using Spring's static pointcuts107
Using dynamic pointcuts111
Pointcut operations113
3.4Creating introductions115
Implementing IntroductionInterceptor115
Creating an IntroductionAdvisor119
Using introduction advice carefully120
3.5Using ProxyFactoryBean122
3.6Autoproxying124
BeanNameAutoProxyCreator124
DefaultAdvisorAutoProxyCreator126
Metadata autoproxying128
3.7Summary128
Part 2Spring in the business layer131
4Hitting the database133
4.1Learning Spring's DAO philosophy134
Understanding Spring's DataAccessException135
Working with DataSources137
Consistent DAO support139
4.2Using JDBC with Spring141
The problem with JDBC code142
Using JdbcTemplate144
Creating operations as objects152
Auto-incrementing keys155
4.3Introducing Spring's ORM framework support156
4.4Integrating Hibernate with Spring157
Hibernate overview157
Managing Hibernate resources159
Accessing Hibernate through HibernateTemplate162
Subclassing HibernateDaoSupport163
4.5Spring and JDO164
Configuring JDO164
Accessing data with JdoTemplate165
4.6Spring and iBATIS166
Setting up SQL Maps167
Using SqlMapClientTemplate168
4.7Spring and OJB169
Setting up OJB's PersistenceBroker169
4.8Summary171
5Managing transactions173
5.1Understanding transactions174
Explaining transactions in only four words176
Understanding Spring's transaction management support177
Introducing Spring's transaction manager178
5.2Programming transactions in Spring181
5.3Declaring transactions183
Understanding transaction attributes185
Declaring a simple transaction policy189
5.4Declaring transactions by method name191
Using NameMatchTransactionAttributeSource191
Shortcutting name-matched transactions194
5.5Declaring transactions with metadata195
Sourcing transaction attributes from metadata196
Declaring transactions with Commons Attributes197
5.6Trimming down transaction declarations201
Inheriting from a parent TransactionProxyFactoryBean202
Autoproxying transactions203
5.7Summary206
6Remoting207
6.1Spring remoting overview208
6.2Working with RMI212
Wiring RMI services212
Exporting RMI services214
6.3Remoting with Hessian and Burlap218
Accessing Hessian/Burlap services219
Exposing bean functionality with Hessian/Burlap220
6.4Using Http invoker223
Accessing services via HTTP224
Exposing beans as HTTP Services225
6.5Working with EJBs226
Accessing EJBs227
Developing Spring-enabled EJBs231
6.6Using JAX-RPC web services233
Referencing a web service with JAX-RPC234
Wiring a web service in Spring236
6.7Summary238
7Accessing enterprise services240
7.1Retrieving objects from JNDI241
Working with conventional JNDI241
Proxying JNDI objects243
7.2Sending e-mail244
7.3Scheduling tasks248
Scheduling with Java's Timer248
Using the Quartz scheduler250
Invoking methods on a schedule254
7.4Sending messages with JMS256
Sending messages with JMS templates257
Consuming messages261
Converting messages263
7.5Summary266
Part 3Spring in the web layer267
8Building the web layer269
8.1Getting started with Spring MVC270
A day in the life of a request271
Configuring DispatcherServlet272
Spring MVC in a nutshell275
8.2Mapping requests to controllers279
Mapping URLs to bean names280
Using SimpleUrlHandlerMapping281
Using metadata to map controllers281
Working with multiple handler mappings282
8.3Handling requests with controllers283
Writing a simple controller285
Processing commands287
Processing form submissions289
Processing complex forms with wizards294
Handling multiple actions in one controller301
Working with Throwaway controllers305
8.4Resolving views307
Using template views308
Resolving view beans310
Choosing a view resolver313
8.5Using Spring's bind tag314
8.6Handling exceptions317
8.7Summary317
9View layer alternatives319
9.1Using Velocity templates321
Defining the Velocity view321
Configuring the Velocity engine322
Resolving Velocity views323
Formatting dates and numbers324
Exposing request and session attributes325
Binding form fields in Velocity326
9.2Working with FreeMarker327
Constructing a FreeMarker view328
Configuring the FreeMarker engine329
Resolving FreeMarker views330
Binding form fields in FreeMarker330
9.3Designing page layout with Tiles332
Tile views332
Tile controllers335
9.4Generating non-HTML output337
Producing Excel spreadsheets338
Generating PDF documents340
Generating other non-HTML files343
9.5Summary344
10Working with other web frameworks346
10.1Working with Jakarta Struts347
Registering the Spring plug-in348
Implementing Spring-aware Struts actions348
Delegating actions350
10.2Working with Tapestry352
Replacing the Tapestry Engine353
Loading Spring beans into Tapestry pages355
10.3Integrating with JavaServer Faces357
Resolving variables357
Publishing request handled events361
10.4Integrating with WebWork362
WebWork 1363
XWork/WebWork2364
10.5Summary365
11Securing Spring applications367
11.1Introducing the Acegi Security System368
Security interceptors369
Authentication managers370
Access decisions managers370
Run-as managers370
11.2Managing authentication371
Configuring a provider manager371
Authenticating against a database373
Authenticating against an LDAP repository382
Enabling Single Sign-On with Acegi and Yale CAS384
11.3Controlling access389
Voting access decisions389
Deciding how to vote390
Handling voter abstinence392
11.4Securing web applications392
Proxying Acegi's filters394
Enforcing web security397
Processing a login400
Setting up the security context406
Ensuring a secure channel407
Using the Acegi tag library411
11.5Securing method invocations412
Creating a security aspect412
Securing methods using metadata414
11.6Summary416
Appendix ASpring setup417
A.1Downloading Spring418
A.2Choosing a distribution418
A.3Setting up your project419
A.4Building with Ant420
Appendix BSpring-related projects422
B.1AppFuse423
B.2Rich Client Project424
B.3Spring.NET424
Index427

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews