Spring in Practice
Willie Wheeler with Joshua White
  • May 2013
  • ISBN 9781935182054
  • 560 pages
  • printed in black & white

This is the Spring introduction you’ve been waiting for.

John Tyler, PROS Inc.

Spring in Practice shows you how to tackle the challenges you face when you build Spring-based applications. The book empowers software developers to solve concrete business problems by mapping application-level issues to Spring-centric solutions.

It diverges from other cookbooks because it presents the background you need to understand the domain in which a solution applies before it offers the specific steps to solve the problem.

About the book

Spring in Practice covers 66 Spring development techniques and the practical issues you will encounter when using them. The book starts with three carefully crafted introductory chapters to get you up to speed on the fundamentals. And then, the core of the book takes you step-by-step through the important, practical techniques you will use no matter what type of application you're building. You'll hone your Spring skills with examples on user accounts, security, NoSQL data stores, and application integration. Along the way, you'll explore Spring-based approaches to domain-specific challenges like CRM, configuration management, and site reliability.

Table of Contents detailed table of contents



about Spring

about this book

about the cover illustration

1. Introducing Spring: the dependency injection container

1.1. What is Spring, and why use it?

1.2. Flexible configuration via dependency injection

1.3. A simple bean configuration example

1.4. Wiring beans using XML

1.5. Autowiring and component scanning using annotations

1.6. Summary

2. Data persistence, ORM, and transactions

2.1. Data access using JDBC

2.2. Looking up a DataSource with JNDI

2.3. Object-relational mapping and transactions via Hibernate

2.4. Creating a data access layer

2.5. Working with JPA (optional)

2.6. Spring Data JPA overview (optional)

2.7. Summary

3. Building web applications with Spring Web MVC

3.1. Spring Web MVC background

3.2. Creating your first Spring Web MVC application

3.3. Serving and processing forms

3.4. Configuring Spring Web MVC: web.xml

3.5. Configuring Spring Web MVC: the application context

3.6. Spring Mobile technology preview

3.8. Summary

4. Basic web forms

4.1. Displaying a web form

4.2. Externalizing strings in the view

4.3. Validating form data

4.4. Saving form data

4.5. Summary

5. Enhancing Spring MVC applications with Web Flow

5.1. Is Spring Web Flow right for you?

5.2. An overview of Spring Web Flow

5.3. The Spring Soccer Club demo application

5.4. Using action classes

5.5. Form data binding

5.6. Form validation

5.7. Flow and state inheritance

5.8. Securing web flows

5.9. Summary

6. Authenticating users

6.1. Implementing login and logout with remember-me authentication

6.2. Customizing the login page

6.3. Implementing an always-resident login form

6.4. Sourcing user data from a database

6.5. Customizing the user database schema

6.6. Using a custom user service and user principal

6.7. Secure user passwords in the database

6.8. Auto-authenticating the user after a successful registration

6.9. Summary

7. Authorizing user requests

7.1. Authorizing Java methods using authentication levels, roles, and permissions

7.2. Authorizing JSP views using authentication levels, roles, and permissions

7.3. Authorizing web resources using authentication levels, roles, and permissions

7.4. Authorizing method invocations based on ACLs

7.5. Displaying web navigation and content based on ACLs

7.6. Summary

8. Communicating with users and customers

8.1. Create a web-based Contact Us form

8.2. Autogenerate an email response and email notification

8.3. Speeding up autogenerated emails

8.4. Allowing users to subscribe to a mailing list

8.5. Publishing a news feed

8.6. Summary

9. Creating a rich-text comment engine

9.1. Creating a basic user comment engine

9.2. Integrating the comment engine with an article-delivery service

9.3. Adding rich-text support to the comment engine

9.4. Testing the HTML filter

9.5. Summary

10. Integration testing

10.1. Configuring Maven for integration testing

10.2. Writing transactional happy-path integration tests

10.3. Verifying that code under test throws an exception

10.4. Creating integration tests that verify performance

10.5. Ignoring a test

10.6. Running integration tests against an embedded database

10.7. Summary

11. Building a configuration management database

11.1. Creating a simple configuration item

11.3. Adding a RESTful web service

11.4. Updating the CMDB after successful builds

11.5. Sourcing public GitHub data

11.6. Sourcing private GitHub data

11.7. Encrypting access tokens for production use

11.8. Summary

12. Building an article-delivery engine

12.1. Storing articles in a content repository

12.2. Creating a web-based article-delivery engine

12.3. Storing articles in a document repository

12.4. Summary

13. Enterprise integration

13.1. A whirlwind tour of Spring Integration

13.2. Integrating applications via a shared database

13.3. Decoupling applications with RESTful web services

13.4. Implementing a message bus using RabbitMQ and Spring Integration

13.5. Sourcing tickets from an IMAP store

13.6. Send confirmation messages over SMTP

13.7. Summary

14. Creating a Spring-based "site-up" framework

14.1. Circuit-breaker overview

14.2. Creating a circuit-breaker template and callback

14.3. Exposing the circuit breaker as a JMX MBean

14.4. Supporting AOP-based configuration

14.5. Supporting custom namespaces

14.6. Supporting annotation-based configuration

14.7. Summary

Appendix A: Working with the sample code


What's inside

  • Covers Spring 3
  • Successful outcomes with integration testing
  • Dozens of web app techniques using Spring MVC
  • Practical examples and real-world context
  • How to work effectively with data

About the reader

Each technique highlights something new or interesting about Spring and focuses on that concept in detail. This book assumes you have a good foundation in Java and Java EE. Prior exposure to Spring Framework is helpful but not required.

About the authors

Willie Wheeler is a Principal Applications Engineer with 16 years of experience in Java/Java EE and Spring Framework. Joshua White is a Solutions Architect in the financial and health services industries. He has worked with Spring Framework since its inception in 2002.

placing your order...

Don't refresh or navigate away from the page.
print book $31.49 $44.99 pBook + eBook + liveBook
Additional shipping charges may apply
Spring in Practice (print book) added to cart
continue shopping
go to cart

eBook $25.19 $35.99 3 formats + liveBook
Spring in Practice (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks