Read more
Get up to speed quickly with this comprehensive guide to Spring
Beginning Spring is the complete beginner's guide to Java's most popular framework. Written with an eye toward real-world enterprises, the book covers all aspects of application development within the Spring Framework. Extensive samples within each chapter allow developers to get up to speed quickly by providing concrete references for experimentation, building a skillset that drives successful application development by exploiting the full capabilities of Java's latest advances.
Spring provides the exact toolset required to build an enterprise application, and has become the standard within the field. This book covers Spring 4.0, which contains support for Java 8 and Java EE 7. Readers begin with the basics of the framework, then go on to master the most commonly used tools and fundamental concepts inherent in any Spring project. The book emphasizes practicality and real-world application by addressing needs such as meeting customer demand and boosting productivity, and by providing actionable information that helps developers get the most out of the framework. Topics include:
* Dependency Injection and Inversion of Control
* Unit testing Spring enabled Web Applications
* Data Access using Spring JDBC and ORM support along with Transaction Management
* Building Web Applications and RESTful Web Services with Spring MVC
* Securing Web Applications using Spring Security
* Spring Expression Language with its Extensive Features
* Aspect Oriented Programming Facilities Provided by Spring AOP
* Caching with 3rd Party Cache Providers' Support
* The Best of the Breed: Spring 4.0
The information is organized and structured an ideal way for students and corporate training programs, and explanations about inner workings of the framework make it a handy desk reference even for experienced developers. For novices, Beginning Spring is invaluable as a comprehensive guide to the real-world functionality of Spring.
List of contents
FOREWORDS xxvii
INTRODUCTION xxxi
CHAPTER 1: POJO PROGRAMMING MODEL, LIGHTWEIGHT CONTAINERS, AND INVERSION OF CONTROL 1
POJO Programming Model 2
Problems of the Old EJB Programming Model 2
Benefits of the POJO Programming Model 7
Lightweight Containers and Inversion of Control (IoC) 8
Lightweight Containers 8
Inversion of Control (IoC) 9
Dependency Injection 10
Setter Injection 11
Constructor Injection 11
Setter or Constructor Injection 12
Summary 12
CHAPTER 2: DEPENDENCY INJECTION WITH SPRING 17
Spring IoC Container 18
Configuration Metadata 18
Configuring and Using the Container 21
Dependency Injection 29
Setter Injection 30
Constructor Injection 31
Circular Dependencies 34
Dependency Resolution Process 35
Overriding Bean Definitions 36
Using the depends?]on Attribute 38
Autowiring 39
Bean Lookups 43
Spring?]Managed Beans 44
Naming Beans 44
Bean Instantiation Methods 45
Bean Scopes 48
Lazy Initialization 51
Life-Cycle Callbacks 52
Bean Definition Profiles 54
Environment 56
Summary 59
CHAPTER 3: BUILDING WEB APPLICATIONS USING SPRING MVC 63
Learning the Features and Benefits of Spring MVC 64
Using the Dispatcher Servlet Mechanism 65
Defining the Servlet 66
Accessing Servlet Context 67
Creating Your First Spring MVC Application 68
Configuring Spring MVC with Annotations 71
Handling Forms with JSP 73
Configuring the Form Tag Library 73
Understanding the Power of Binding 74
Working with Forms 74
Using Input Elements 75
Entering Dates 76
Selecting from a Drop?]Down 77
Selecting with Radio Buttons 78
Selecting with Checkboxes 78
Adding Labels 78
Placing Buttons 79
Styling 79
Exploiting the Power of Annotations 84
@Controller 84
@RequestMapping 84
@ModelAttribute 84
@PathVariable 85
@ControllerAdvice 85
@InitBinder 85
@ExceptionHandler 85
Validating User Input 86
Uploading Files 90
Handling Exceptions 93
Implementing Internationalization (i18n) 95
Using Themes 97
Summary 100
CHAPTER 4: JDBC DATA ACCESS WITH SPRING 103
Problems with Using Vanilla JDBC 104
Introducing Spring's JDBC Support 105
Managing JDBC Connections 105
Embedded DB Support 108
Using a Connection?]Pooled DataSource 110
Initializing DB 111
Configuring and Using Spring's JDBC Support 112
Performing Data Access Operations with Spring 114
Running Queries 114
Queries with Named Parameters 117
Writing Queries Using the IN Clause 118
Using PreparedStatements within JdbcTemplate 119
Inserting, Updating, and Deleting Records 121
Calling Stored Procedures and Stored Functions 124
Performing Batch Operations 126
Handling BLOB and CLOB Objects 126
Accessing Vendor?]Specific JDBC Methods 127
Executing DDL Operations 127
Modeling JDBC Operations as Java Objects 128
Encapsulating SQL Query Executions 128
Encapsulating SQL DML Operations 130
Encapsulating Stored Procedure Executions 131
Exception Handling an
About the author
Mert Çaliskan is an Oracle Java Champion and has been working as Principal Architect in Turkey. He has more than 10 years' experience in software development, where he has focused on architectural design of enterprise web applications. Kenan Sevindik is a Sun certified Java J2EE Business and Web Component developer, with more than 15 years of Java development experience. He has extensive experience with the major enterprise Java frameworks and gives seminars on a variety of Java concepts.
Rod Johnson is an enterprise Java architect specializing in scalable web applications. He has worked with both Java and J2EE since their release, and he is a member of JSR 154 Expert Group defining the Servlet 2.4 specification.
Summary
Get up to speed quickly with this comprehensive guide to Spring Beginning Spring is the complete beginner's guide to Java's most popular framework. Written with an eye toward real-world enterprises, the book covers all aspects of application development within the Spring Framework.