更新时间:2021-08-27 18:50:22
封面
Title Page
Copyright and Credits
Java 9 Dependency Injection
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Why Dependency Injection?
Design patterns
Dependency Inversion Principle
Inversion of Control
Implementing DIP through IoC
Inverting the interface
Inverting object creation
Different ways to invert object creation
Inversion of object creation through the factory pattern
Inversion of object creation through service locator
Dependency injection
Dependency injection types
Constructor injection
Setter injection
Interface injection
IoC containers
Summary
Dependency Injection in Java 9
Java 9 introduction
Key features
Java Platform Module System
JShell (REPL) – The Java Shell
JLink – Module Linker
Multi-release JAR files
Stream API enhancements
Stack-walking API
Immutable collections with convenient factory methods
HTTP/2.0 support
Modular Framework in Java 9
What is modularity?
The need for a Java modular system
Modular JDK
What is a module?
Structure of a module
Module Descriptor (module-info.java)
Module types
Dependency Injection using the Java 9 Modular Framework
Modules with Service Loader
Service (API) module
Service provider (Implementation) module
Service client application
Writing modular code using a command-line interface
Defining dependency between modules
Compiling and running modules
Dependency Injection with Spring
A brief introduction to Spring framework
Spring framework architecture
Core container layer
Data access/integration layer
Spring web layer
Spring test
Miscellaneous
Bean management in Spring container
Spring IoC container
Configuration
Containers in action
Dependency Injection (DI) in Spring
Constructor-based DI
Setter-based DI
Spring DI with the factory method
Static factory method
Instance (non-static) factory method
Auto-wiring in Spring
Auto-wiring by name
Auto-wiring by type
Auto-wiring by constructor
Annotation-based DI
DI through XML configuration
Defining annotation
Activating annotation-based configuration
Defining a Java class as <bean> with annotation
Annotation with the factory method
DI with Java configuration
Dependency Injection with Google Guice
A brief introduction to the Google Guice framework
Guice setup
Dependency injection and JSR-330