BN.com Gift Guide

Spring Recipes: A Problem-Solution Approach

Overview

Spring addresses most aspects of Java/Java EE application development and offers simple solutions to them. By using Spring, you will be lead to use industry best practices to design and implement your applications. The releases of Spring 2.x added many improvements and new features to the 1.x versions. Spring Recipes: A Problem–Solution Approach focuses on Spring 2.5 features for building enterprise Java applications.

Spring Recipes covers Spring 2.5 from basic to advanced, ...

See more details below
Paperback
$34.41
BN.com price
(Save 31%)$49.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (16) from $1.99   
  • New (9) from $32.76   
  • Used (7) from $1.99   
Spring Recipes: A Problem-Solution Approach

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$22.99
BN.com price
(Save 42%)$39.99 List Price

Overview

Spring addresses most aspects of Java/Java EE application development and offers simple solutions to them. By using Spring, you will be lead to use industry best practices to design and implement your applications. The releases of Spring 2.x added many improvements and new features to the 1.x versions. Spring Recipes: A Problem–Solution Approach focuses on Spring 2.5 features for building enterprise Java applications.

Spring Recipes covers Spring 2.5 from basic to advanced, including Spring IoC container, Spring AOP and AspectJ, Spring data access support, Spring transaction management, Spring Web and Portlet MVC, Spring testing support, Spring support for remoting, EJB, JMS, JMX, E–mail, scheduling, and scripting languages. This book also introduces several common Spring Portfolio projects that will bring significant value to your application development, including Spring Security, Spring Web Flow, and Spring Web Services.

The topics in this book are introduced by complete and real–world code examples that you can follow step by step. Instead of abstract descriptions on complex concepts, you will find live examples in this book. When you start a new project, you can consider copying the code and configuration files from this book, and then modifying them for your needs. This can save you a great deal of work over creating a project from scratch.

What you’ll learn

  • Installing the Spring framework and Spring IDE, using the Spring IoC container and the Spring application context
  • Understanding aspect-oriented programming concepts, using classic and new Spring AOP, integrating Spring with AspectJ, and load–time weaving aspects
  • Using Spring to simplify data access (with JDBC, Hibernate, and JPA) and manage transactions programmatically and declaratively
  • Building web applications and portlets with Spring Web MVC and Portlet MVC, and integrating Spring with Struts, JSF, and DWR
  • Understanding the unit testing and integration testing concepts, and Spring’s unit and integration testing support (on JUnit 3.8, JUnit 4, and TestNG)
  • Using Spring’s support for remoting technologies (RMI, Hessian, Burlap, and HTTP Invoker), EJB, JMS, JMX, E-mail, scheduling, and scripting languages
  • Understanding security concepts (authentication, authorization, and access control), and securing web applications using Spring Security
  • Managing complex web application page flows using Spring Web Flow, and integrating Spring Web Flow with JSF
  • Exposing contract–last web services using XFire, and developing contract–first web services using Spring Web Services

Who this book is for

This book is for Java developers who would like to gain hands–on experience rapidly on Java/Java EE development using the Spring framework. If you are already a developer using Spring in your projects, you can also use this book as a reference, and you’ll find the code examples very useful.

You don’t need much Java EE experience to read this book. However, it assumes that you know the basics of object–oriented programming with Java (e.g., creating a class/interface, implementing an interface, extending a base class, running a main class, setting up your classpath, and so on). It also assumes you have basic knowledge on web and database concepts and know how to create dynamic web pages and query databases with SQL statements.

Read More Show Less

Product Details

  • ISBN-13: 9781430224990
  • Publisher: Apress
  • Publication date: 9/1/2010
  • Edition number: 2
  • Pages: 1104
  • Sales rank: 1,393,064
  • Product dimensions: 7.76 (w) x 11.08 (h) x 2.20 (d)

Meet the Author

Gary Mak, founder and chief consultant of Meta-Archit Software Technology Limited, has been a technical architect and application developer on the enterprise Java platform for more than seven years. He is the author of the Apress books Spring Recipes: A Problem-Solution Approach and Pro SpringSource dm Server. In his career, Gary has developed a number of Java-based software projects, most of which are application frameworks, system infrastructures, and software tools. He enjoys designing and implementing the complex parts of software projects. Gary has a master's degree in computer science. His research interests include object-oriented technology, aspect-oriented technology, design patterns, software reuse, and domain-driven development.

Gary specializes in building enterprise applications on technologies including Spring, Hibernate, JPA, JSF, Portlet, AJAX, and OSGi. He has been using the Spring Framework in his projects since Spring version 1.0. Gary has been an instructor of courses on enterprise Java, Spring, Hibernate, Web Services, and agile development. He has written a series of Spring and Hibernate tutorials as course materials, parts of which are open to the public, and they're gaining popularity in the Java community. In his spare time, he enjoys playing tennis and watching tennis competitions.

Read More Show Less

Table of Contents


About the Author     xv
About the Technical Reviewers     xvii
Acknowledgments     xix
Introduction     xxi
Core
Inversion of Control and Containers     3
Using a Container to Manage Your Components     4
Using a Service Locator to Reduce Lookup Complexity     9
Applying Inversion of Control and Dependency Injection     11
Understanding Different Types of Dependency Injection     13
Configuring a Container with a Configuration File     17
Summary     20
Introduction to Spring     21
Introducing the Spring Framework     21
Installing the Spring Framework     26
Setting Up a Spring Project     28
Installing Spring IDE     30
Using Spring IDE's Bean-Supporting Features     32
Summary     39
Bean Configuration in Spring     41
Configuring Beans in the Spring IoC Container     41
Instantiating the Spring IoC Container     45
Resolving Constructor Ambiguity     48
Specifying Bean References     51
Checking Properties with Dependency Checking     55
Checking Properties with the @Required Annotation     58
Auto-Wiring Beans with XML Configuration     60
Auto-Wiring Beans with @Autowired and @Resource     64
Inheriting Bean Configuration     71
Defining Collections for Bean Properties     74
Specifying the Data Type for Collection Elements     81
Defining Collections Using Factory Beans and the Utility Schema     84
Scanning Components from the Classpath     86
Summary     92
Advanced Spring IoC Container     93
Creating Beans by Invoking a Constructor     93
Creating Beans by Invoking a Static Factory Method     97
Creating Beans by Invoking an Instance Factory Method     98
Creating Beans Using Spring's Factory Bean     100
Declaring Beans from Static Fields     102
Declaring Beans from Object Properties     104
Setting Bean Scopes     106
Customizing Bean Initialization and Destruction     108
Making Beans Aware of the Container     114
Creating Bean Post Processors     115
Externalizing Bean Configurations     120
Resolving Text Messages     121
Communicating with Application Events     123
Registering Property Editors in Spring     126
Creating Custom Property Editors     129
Loading External Resources     131
Summary     134
Dynamic Proxy and Classic Spring AOP     135
Problems with Non-Modularized Crosscutting Concerns     136
Modularizing Crosscutting Concerns with Dynamic Proxy     144
Modularizing Crosscutting Concerns with Classic Spring Advices     150
Matching Methods with Classic Spring Pointcuts     160
Creating Proxies for Your Beans Automatically     163
Summary     165
Spring 2.x AOP and AspectJ Support     167
Enabling AspectJ Annotation Support in Spring     168
Declaring Aspects with AspectJ Annotations     170
Accessing the Join Point Information     176
Specifying Aspect Precedence     178
Reusing Pointcut Definitions     180
Writing AspectJ Pointcut Expressions     182
Introducing Behaviors to Your Beans     187
Introducing States to Your Beans     190
Declaring Aspects with XML-Based Configurations     192
Load-Time Weaving AspectJ Aspects in Spring     196
Configuring AspectJ Aspects in Spring     201
Injecting Spring Beans into Domain Objects     202
Summary      206
Fundamentals
Spring JDBC Support     209
Problems with Direct JDBC     209
Using a JDBC Template to Update a Database     216
Using a JDBC Template to Query a Database     221
Simplifying JDBC Template Creation     227
Using the Simple JDBC Template with Java 1.5     230
Using Named Parameters in a JDBC Template     233
Modeling JDBC Operations As Fine-Grained Objects     236
Handling Exceptions in the Spring JDBC Framework     240
Summary     245
Transaction Management in Spring     247
Problems with Transaction Management     248
Choosing a Transaction Manager Implementation     253
Managing Transactions Programmatically with the Transaction Manager API     255
Managing Transactions Programmatically with a Transaction Template     257
Managing Transactions Declaratively with Classic Spring AOP     260
Managing Transactions Declaratively with Transaction Advices     263
Managing Transactions Declaratively with the @Transactional Annotation     265
Setting the Propagation Transaction Attribute     266
Setting the Isolation Transaction Attribute     271
Setting the Rollback Transaction Attribute     279
Setting the Timeout and Read-Only Transaction Attributes     280
Managing Transactions with Load-Time Weaving     282
Summary     285
Spring ORM Support     287
Problems with Using ORM Frameworks Directly     288
Configuring ORM Resource Factories in Spring     299
Persisting Objects with Spring's ORM Templates     306
Persisting Objects with Hibernate's Contextual Sessions     312
Persisting Objects with JPA's Context Injection     315
Summary     319
Spring MVC Framework     321
Developing a Simple Web Application with Spring MVC     321
Mapping Requests to Handlers     333
Intercepting Requests with Handler Interceptors     336
Resolving User Locales     339
Externalizing Locale-Sensitive Text Messages     342
Resolving Views by Names     343
Mapping Exceptions to Views     346
Constructing ModelAndView Objects     348
Creating a Controller with a Parameterized View     351
Handling Forms with Form Controllers     353
Handling Multipage Forms with Wizard Form Controllers     366
Grouping Multiple Actions into a Controller     375
Creating Excel and PDF Views      381
Developing Controllers with Annotations     385
Summary     393
Integrating Spring with Other Web Frameworks     395
Accessing Spring in Generic Web Applications     395
Integrating Spring with Struts 1.x     400
Integrating Spring with JSF     407
Integrating Spring with DWR     412
Summary     416
Spring Testing Support     417
Creating Tests with JUnit and TestNG     418
Creating Unit Tests and Integration Tests     423
Unit Testing Spring MVC Controllers     433
Managing Application Contexts in Integration Tests     438
Injecting Test Fixtures into Integration Tests     444
Managing Transactions in Integration Tests     449
Accessing a Database in Integration Tests     455
Using Spring's Common Testing Annotations     459
Summary     461
Advanced
Spring Security     465
Securing URL Access     465
Logging In to Web Applications     476
Authenticating Users     480
Making Access Control Decisions     490
Securing Method Invocations     494
Handling Security in Views      497
Handling Domain Object Security     499
Summary     509
Spring Portlet MVC Framework     511
Developing a Simple Portlet with Spring Portlet MVC     511
Mapping Portlet Requests to Handlers     519
Handling Portlet Forms with Simple Form Controllers     529
Developing Portlet Controllers with Annotations     537
Summary     543
Spring Web Flow     545
Managing a Simple UI Flow with Spring Web Flow     545
Modeling Web Flows with Different State Types     552
Securing Web Flows     565
Persisting Objects in Web Flows     568
Integrating Spring Web Flow with JSF     574
Summary     580
Spring Remoting and Web Services     583
Exposing and Invoking Services Through RMI     584
Exposing and Invoking Services Through HTTP     588
Choosing a Web Service Development Approach     592
Exposing and Invoking Web Services Using XFire     595
Defining the Contract of Web Services     601
Implementing Web Services Using Spring-WS     605
Invoking Web Services Using Spring-WS     612
Developing Web Services with XML Marshalling     615
Creating Service Endpoints with Annotations     621
Summary     622
Spring Support for EJB and JMS     625
Creating EJB 2.x Components with Spring     625
Accessing EJB 2.x Components in Spring     631
Accessing EJB 3.0 Components in Spring     637
Sending and Receiving JMS Messages with Spring     640
Creating Message-Driven POJOs in Spring     655
Summary     661
Spring Support for JMX, E-mail, and Scheduling     663
Exporting Spring Beans As JMX MBeans     663
Publishing and Listening to JMX Notifications     675
Accessing Remote JMX MBeans in Spring     677
Sending E-mail with Spring's E-mail Support     680
Scheduling with Spring's JDK Timer Support     688
Scheduling with Spring's Quartz Support     691
Summary     696
Scripting in Spring     697
Implementing Beans with Scripting Languages     697
Injecting Spring Beans into Scripts     702
Refreshing Beans from Scripts     705
Defining Script Sources Inline     706
Summary     707
Index     709
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)