更新时间:2021-07-02 22:13:39
coverpage
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
Evolution to Spring Framework 5.0
Spring Framework
Problems with EJB
Why is Spring Framework popular?
Simplified unit testing
Reduction in plumbing code
How does Spring Framework do this magic?
Architectural flexibility
Keep up with changing times
Spring modules
Spring Core Container
Cross-cutting concerns
Web
Business
Data
Spring Projects
Spring Boot
Spring Cloud
Spring Data
Spring Batch
Spring Security
Spring HATEOAS
New features in Spring Framework 5.0
Baseline upgrades
JDK 9 runtime compatibility
Usage of JDK 8 features in Spring Framework code
Reactive programming support
Functional web framework
Java modularity with Jigsaw
Kotlin support
Dropped features
Spring Boot 2.0 new features
Summary
Dependency Injection
Understanding dependency injection
Understanding dependencies
The Spring IoC container
Defining beans and wiring
Creating a Spring IoC container
Java configuration for the application context
A quick review
Launching the application context with Java configuration
The console log
The XML configuration for the application context
Defining the XML Spring configuration
Launching an application context with the XML configuration
Writing JUnit using the Spring context
Unit testing with mocks
Container managed beans
Dependency injection types
The setter injection
The constructor injection
Constructor versus setter injection
Spring bean scopes
Java versus XML configuration
The @Autowired annotation in depth
The @Primary annotation
The @Qualifier annotation
Other important Spring annotations
Exploring Contexts and dependency injection
An example of CDI
Building a Web Application with Spring MVC
Java web application architecture
Model 1 architecture
Model 2 architecture
Model 2 Front Controller architecture
Basic flows
Basic setup
Adding dependency for Spring MVC
Adding DispatcherServlet to web.xml
Creating Spring context
Flow 1 - Simple controller flow without View
Creating a Spring MVC controller
Running the web application
Unit testing
Setting up the Controller to test
Writing the Test method
Flow 2 - Simple controller flow with a View
Spring MVC controller
Creating a View - a JSP