Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Spring 5 Design Patterns

You're reading from   Spring 5 Design Patterns Master efficient application development with patterns such as proxy, singleton, the template method, and more

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781788299459
Length 396 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dinesh Rajput Dinesh Rajput
Author Profile Icon Dinesh Rajput
Dinesh Rajput
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with Spring Framework 5.0 and Design Patterns 2. Overview of GOF Design Patterns - Core Design Patterns FREE CHAPTER 3. Consideration of Structural and Behavioral Patterns 4. Wiring Beans using the Dependency Injection Pattern 5. Understanding the Bean Life Cycle and Used Patterns 6. Spring Aspect Oriented Programming with Proxy and Decorator pattern 7. Accessing a Database with Spring and JDBC Template Patterns 8. Accessing Database with Spring ORM and Transactions Implementing Patterns 9. Improving Application Performance Using Caching Patterns 10. Implementing the MVC Pattern in a Web Application using Spring 11. Implementing Reactive Design Patterns 12. Implementing Concurrency Patterns

Introducing Spring Framework

In the early days of Java, there were lots of heavier enterprise Java technologies for enterprise applications that provided enterprise solutions to programmers. However, it was not easy to maintain the applications because it was tightly coupled with the framework. A couple of years ago, apart from Spring, all Java technologies were heavier, like EJB. At the time, Spring was introduced as an alternative technology especially made for EJB because Spring provided a very simple, leaner, and lighter programming model compared with other existing Java technologies. Spring makes this possible by using many available design patterns, but it focused on the Plain Old Java Object (POJO) programming model. This model provided the simplicity to the Spring Framework. It also empowered ideas such as the dependency injection (DI) pattern and Aspect-Oriented Programming (AOP) by using the Proxy pattern and Decorator pattern.

The Spring Framework is an open source application framework and a Java-based platform that provides comprehensive infrastructure support for developing enterprise Java applications. So developers don't need to care about the infrastructure of the application; they should be focused on the business logic of the application rather than handling the configuration of the application. All infrastructure, configuration, and meta-configuration files, either Java-based configuration or XML-based configuration, both are handled by the Spring Framework. So this framework makes you more flexible in building an application with a POJOs programming model rather than a non-invasive programming model.

The Spring Inversion of Control (IoC) container is the heart of the entire framework. It helps glue together the different parts of the application, thus forming a coherent architecture. Spring MVC components can be used to build a very flexible web tier. The IOC container simplifies the development of the business layer with POJOs.

Spring simplifies the application development and removes a lot of the dependency on the other APIs. Let's see some examples of how you, as an application developer, can benefit from the Spring platform:

  • All application classes are simple POJO classes--Spring is not invasive. It does not require you to extend framework classes or implement framework interfaces for most use cases.
  • Spring applications do not require a Java EE application server, but they can be deployed on one.
  • You can execute a method in a database transaction by using transaction management in Spring Framework without having any third-party transactional API.
  • Using Spring, you can use a Java method as a request handler method or remote method, like a service() method of a servlet API, but without dealing with the servlet API of the servlet container.
  • Spring enables you to use a local java method as a message handler method without using a Java Message Service (JMS) API in the application.
  • Spring also enables you to use the local java method as a management operation without using a Java Management Extensions (JMX) API in the application.
  • Spring serves as a container for your application objects. Your objects do not have to worry about finding and establishing connections with each other.
  • Spring instantiates the beans and injects the dependencies of your objects into the application--it serves as a life cycle manager of the beans.
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime