
Spring 5 Design Patterns
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Other editions
Additional editions

Person
Dinesh Rajput is a founder of Dineshonjava (dot) com, a blog for Spring and Java techies. He is a Spring enthusiast and a Pivotal Certified Spring Professional. He has written two bestselling books, Spring 5 Design Patterns and Mastering Spring Boot 2.0. Mastering Spring Boot 2.0 is the Amazon #1 best-selling book on Java. He has more than 10 years of experience with various aspects of Spring and cloud-native development, such as REST APIs and microservice architecture. He is currently working as an architect at a leading company. He has worked as a tech lead at Bennett, Coleman & Co. Ltd, and Paytm. He has a master's degree in computer engineering from JSS Academy of Technical Education, Noida, and lives in Noida with his family.
Content
- Cover
- Title Page
- Copyright
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Dedication
- Table of Contents
- Preface
- Chapter 1: Getting Started with Spring Framework 5.0 and Design Patterns
- Introducing Spring Framework
- Simplifying application development using Spring and its pattern
- Using the power of the POJO pattern
- Injecting dependencies between POJOs
- How DI works and makes things easy for development and testing
- Using factory helper pattern for dependent components
- Using DI pattern for dependent components
- Applying aspects for cross cutting concerns
- How Spring AOP works
- Applying the template pattern to eliminate boilerplate code
- The Template Design pattern in Spring
- Using a Spring container to manage beans with the Factory pattern
- Bean factory
- Application contexts
- Creating a container with an application context
- Life of a bean in the container
- Spring modules
- Core Spring container
- Spring's AOP module
- Spring DAO - data access and integration
- Spring's ORM
- Spring web MVC
- New features in Spring Framework 5.0
- Summary
- Chapter 2: Overview of GOF Design Patterns - Core Design Patterns
- Introducing the power of design patterns
- Common GoF Design Pattern overview
- Creational design patterns
- Factory design pattern
- Implementing the Factory design pattern in Spring Framework
- Sample implementation of the Factory design pattern
- Abstract factory design pattern
- Common problems where you should apply the Abstract factory design pattern
- Implementing the Abstract factory design pattern in the Spring Framework
- Sample implementation of the Abstract Factory design pattern
- Singleton design pattern
- Common problems where you should apply Singleton pattern
- Singleton design pattern implementation in the Spring Framework
- Sample implementation of the Singleton design pattern
- Prototype design pattern
- Benefits of the Prototype design pattern
- UML class structure
- Sample implementation of the Prototype design pattern
- Builder design pattern
- Benefits of the Builder pattern:
- UML class structure
- Implementing the Builder pattern in the Spring Framework
- Common problems where you should apply Builder pattern
- Sample implementation of the Builder design pattern
- Summary
- Chapter 3: Consideration of Structural and Behavioral Patterns
- Examining the core design patterns
- Structural design patterns
- The adapter design pattern
- Benefits of the adapter pattern
- Common requirements for the adapter pattern
- Implementation of the adapter design pattern in the Spring Framework
- Sample implementation of the adapter design pattern
- The Bridge design pattern
- Benefits of the Bridge pattern
- Common problems solved by the Bridge design pattern
- Implementing the Bridge design pattern in the Spring Framework
- Sample implementation of the Bridge design pattern
- Composite design pattern
- Common problems solved by the composite pattern
- UML structure of the Composite design pattern
- Sample implementation of the Composite design pattern
- Decorator design pattern
- Common problems solved by the Decorator pattern
- Implementing the Decorator pattern
- Decorator design pattern in the Spring Framework
- Facade Design Pattern
- Knowing when to use the Facade Pattern
- Implementing the Facade design pattern
- The UML structure for the Facade design pattern
- Facade Pattern in the Spring Framework
- Proxy design pattern
- Purpose of the Proxy pattern
- UML structure for the Proxy design pattern
- Implementing the Proxy design pattern
- Proxy pattern in the Spring Framework
- Behavioral design patterns
- Chain of Responsibility design pattern
- Chain of Responsibility pattern in the Spring Framework
- Command design pattern
- Command design pattern in the Spring Framework
- Interpreter Design pattern
- Interpreter design pattern in the Spring Framework
- Iterator Design Pattern
- Iterator design pattern in the Spring Framework
- Observer pattern in the Spring Framework
- Template Design Pattern
- JEE design patterns
- Summary
- Chapter 4: Wiring Beans using the Dependency Injection Pattern
- The dependency injection pattern
- Solving problems using the dependencies injection pattern
- Without dependency injection
- With dependency injection pattern
- Types of dependency injection patterns
- Constructor-based dependency injection pattern
- Setter-based dependency injection
- Configuring the dependency injection pattern with Spring
- Dependency injection pattern with Java-based configuration
- Creating a Java configuration class - AppConfig.java
- Declaring Spring beans into configuration class
- Injecting Spring beans
- Best approach to configure the dependency injection pattern with Java
- Dependency injection pattern with XML-based configuration
- Creating an XML configuration file
- Declaring Spring beans in an XML file
- Injecting Spring beans
- Using constructor injection
- Using setter injection
- Dependency injection pattern with Annotation-based configuration
- What are Stereotype annotations?
- Creating auto searchable beans using Stereotype annotations
- Searching beans using component scanning
- Annotating beans for autowiring
- Using @Autowired with setter method
- Using @Autowired with the fields
- The Autowiring DI pattern and disambiguation
- Resolving disambiguation in Autowiring DI pattern
- Implementing the Abstract Factory Pattern in Spring (FactoryBean interface)
- Implementation of FactoryBean interface in Spring
- Sample implementation of FactoryBean interface
- Best practices for configuring the DI pattern
- Summary
- Chapter 5: Understanding the Bean Life Cycle and Used Patterns
- The Spring bean life cycle and its phases
- The initialization phase
- Creating the application context from configuration
- Load bean definitions
- Initializing bean instances
- Customizing beans using a BeanPostProcessor
- The Initializer extension point
- The Use phase of beans
- Implementing the Decorator and Proxy patterns in Spring using Proxies
- The destruction phase of the beans
- Understanding bean scopes
- The singleton bean scope
- The prototype bean scope
- The session bean scope
- The request bean scope
- Other scopes in Spring
- Custom scopes
- Creating custom scopes
- Summary
- Chapter 6: Spring Aspect Oriented Programming with Proxy and Decorator pattern
- Proxy pattern in Spring
- Proxying classes using Decorator pattern in Spring
- What are cross-cutting concerns?
- What is Aspect-Oriented Programming?
- Problems resolved by AOP
- Code tangling
- Code scattering
- How AOP Works to solve problems
- Core AOP terminology and concepts
- Advice
- Join Point
- Pointcut
- Aspect
- Weaving
- Defining pointcuts
- Writing pointcuts
- Creating aspects
- Define aspects using Annotation
- Implementing Advice
- Advice type - Before
- Before Advice example
- Advice Types: After Returning
- After Returning Advice example
- Advice Types: After Throwing
- After Throwing Advice example
- Advice Types: After
- After Advice example
- Advice Types - Around
- Around Advice example
- Define aspects using XML configuration
- Understanding AOP proxies
- Summary
- Chapter 7: Accessing a Database with Spring and JDBC Template Patterns
- The best approach to designing your data-access
- The resource management problem
- Implementing the template design pattern
- Problems with the traditional JDBC
- Solving problems with Spring's JdbcTemplate
- Configuring the data source and object pool pattern
- Configuring a data source using a JDBC driver
- Configuring the data source using pool connections
- Implementing the Builder pattern to create an embedded data source
- Abstracting database access using the DAO pattern
- The DAO pattern with the Spring Framework
- Working with JdbcTemplate
- When to use JdbcTemplate
- Creating a JdbcTemplate in an application
- Implementing a JDBC-based repository
- Jdbc callback interfaces
- Creating a RowMapper class
- Implementing RowCallbackHandler
- Implementing ResultSetExtractor
- Best practices for Jdbc and configuring JdbcTemplate
- Summary
- Chapter 8: Accessing Database with Spring ORM and Transactions Implementing Patterns
- ORM Framework and the patterns used
- Resource and transaction management
- Consistent exception handling and translation
- The data access object pattern
- Creating DAOs using the Factory design pattern in Spring
- The Data Mapper pattern
- The domain model pattern
- Proxy for the lazy loading pattern
- Spring's Hibernate template pattern
- Integrating Hibernate with Spring
- Configuring Hibernate's SessionFactory in a Spring container
- Implementing DAOs based on the plain Hibernate API
- Transaction management strategies in Spring
- Declarative transaction demarcation and implementation
- Deploying the transaction manager
- Step 1 - Implementing the transaction manager
- Step 2 - Declaring the transaction demarcation
- Programmatic transaction demarcation and implementation
- Best practices for Spring ORM and transaction module in an application
- Summary
- Chapter 9: Improving Application Performance Using Caching Patterns
- What is cache?
- Where do we use caching?
- Understanding cache abstraction
- Enabling caching via the Proxy pattern
- Enabling the caching proxy using Annotation
- Enabling the Caching Proxy using the XML namespace
- Declarative Annotation-based caching
- The @Cacheable annotation
- The @CachePut annotation
- Customizing the cache key
- Conditional caching
- The @CacheEvict annotation
- The @Caching annotation
- The @CacheConfig annotation
- Declarative XML-based caching
- Configuring the cache storage
- Setting up the CacheManager
- Third-party cache implementations
- Ehcache-based cache
- XML-based configuration
- Creating custom caching annotations
- Top caching best practices to be used in a web application
- Summary
- Chapter 10: Implementing the MVC Pattern in a Web Application using Spring
- Implementing the MVC pattern in a web application
- Model 2 architecture MVC pattern with Spring
- The Front Controller design pattern
- Processing the life of a request
- Configuring DispatcherServlet as the Front Controller
- Defined by XML configuration
- Defined by Java configuration
- Enabling the Spring MVC
- Implementing controllers
- Defining a controller with @Controller
- Mapping requests with @RequestMapping
- @RequestMapping at method level
- @RequestMapping at the class level
- Defining @RequestMapping handler methods
- Passing model data to the view
- Accepting request parameters
- Taking query parameters
- Taking request parameters via path variables
- Processing forms of a web page
- Implementing a form handling controller
- Data binding with Command Design pattern
- Using @ModelAttributes for customizing data binding
- Validating forms input parameters
- Implementing View in the MVC pattern
- Defining ViewResolver in the Spring MVC
- Implement the View
- Register ViewResolver with Spring MVC
- The View Helper pattern
- Composite View pattern using Apache tile view resolver
- Configuring a Tiles ViewResolver
- Best practices for web application design
- Summary
- Chapter 11: Implementing Reactive Design Patterns
- Understanding application requirement over the years
- Understanding the reactive pattern
- The reactive pattern traits
- Responsiveness
- Resilience
- Scalable
- Message-driven architecture
- Blocking calls
- Non-blocking calls
- Back-pressure
- Implementing reactive with the Spring 5 Framework
- Reactive Streams
- Spring Web reactive module
- Implementing a reactive web application at the server side
- The Annotation-based programming model
- The functional programming model
- Implementing a Reactive Client-Side application
- Request and response body conversion
- Summary
- Chapter 12: Implementing Concurrency Patterns
- Active object pattern
- Monitor object pattern
- Half-Sync/Half-Async patterns
- Leader/follower pattern
- Reactor pattern
- Thread-specific storage pattern
- Best practices for concurrency module
- Summary
- Index
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.