Spring Recipes: A Problem-Solution Approach [NOOK Book]


Spring Recipes: A Problem-Solution Approach, Second Edition continues the legacy of the bestselling previous edition, but now includes the latest features as available in the new Spring 3.
Read More Show Less
... See more details below
Spring Recipes: A Problem-Solution Approach

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK
  • NOOK HD/HD+ Tablet
  • NOOK
  • 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)
BN.com price
(Save 42%)$39.99 List Price


Spring Recipes: A Problem-Solution Approach, Second Edition continues the legacy of the bestselling previous edition, but now includes the latest features as available in the new Spring 3.
Read More Show Less

Product Details

  • ISBN-13: 9781430225003
  • Publisher: Apress
  • Publication date: 9/1/2010
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 2
  • Pages: 1104
  • Sales rank: 1,013,713
  • File size: 4 MB

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
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
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
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


4 Star


3 Star


2 Star


1 Star


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


  • - 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)