Cargando…

Java 9 Dependency Injection : Write loosely coupled code with Spring 5 and Guice.

Dependency Injection (DI) is a design pattern that allows us to remove the hard-coded dependencies and make our application loosely coupled, extendable, and maintainable. This book will be your one stop guide to write loosely coupled code using the latest features of Java 9 with frameworks such as S...

Descripción completa

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Patel, Nilang
Otros Autores: Patel, Krunal
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Birmingham : Packt Publishing, 2018.
Temas:
Acceso en línea:Texto completo
Tabla de Contenidos:
  • Cover; Title Page; Copyright and Credits; Packt Upsell; Contributors; Table of Contents; Preface; Chapter 1: 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.
  • Chapter 2: Dependency Injection in Java 9Java 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?; Java Platform Module System; 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 LoaderService (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; Summary; Chapter 3: 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 DISetter-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 with annotation; Annotation with the factory method; DI with Java configuration; Summary; Chapter 4: Dependency Injection with Google Guice; A brief introduction to the Google Guice framework; Guice setup.
  • Dependency injection and JSR-330Example of simple DI; Basic injection in Guice; Guice API and Phases; Start up phase; Module interface; The AbstractModule class; Binder; Injector; Guice; Provider; Runtime phase; Guice annotations; Inject; ProvidedBy; ImplementedBy; @Named; Binding in Guice; Linked bindings; Instance bindings; Untargeted bindings; Constructor bindings; Built-in bindings; Just-in-time Bindings; Binding annotations; Guice injection; Constructor Injection; Method injection; Field injection; Optional injection; Static injection; Summary; Chapter 5: Scopes.