Java 9 Dependency Injection

Krunal Patel, Nilang Patel

下單後立即進貨 (1~2週)

相關活動主題

Packt september small

商品描述

Key Features

  • Use DI to make your code loosely coupled to manage and test your applications easily on Spring 5 and Google Guice
  • Identify when to use the Constructor or the Setter approaches for better results
  • Write more maintainable Java code by decoupling your objects from their implementations

Book Description

Dependency Injection is a design pattern that allows us to remove the hard-coded dependencies and make our application loosely coupled, extendable and maintainable. We can implement dependency injection to move the dependency resolution from compile-time to runtime.

This book will be your one stop guide to write loosely coupled code using the latest features of Java 9 with frameworks such as Spring 5 and Google Guice.

The book begins by explaining you what Dependency Injection is and teach you about the IoC containers. From here, you will learn about the Object compositions and its role in DI and will learn to build a modular application. You will learn how to use Dependency Injection to focus your efforts on the business logic unique to your application and let the framework handle the infrastructure work to put it all together. After this, you will explore Spring and Guice, the popular frameworks for Dependency Injection and see how to define injection keys and configure them in the framework-specific level. The book will then teach you how to use dependency injection when writing web applications and implement Aspect oriented programming in Guice and Spring.

Towards the end, you will learn to integrate any third party library in your DI-enabled application and explore common pitfalls and recommendations to build a solid application with DI.

What you will Learn

  • Understand the benefits of Dependency Injection and get from a tightly coupled design to a cleaner design organized around dependencies.
  • Set up Guice and Spring in an application so that it can be used for DI
  • Use scopes for handling complex application scenarios
  • Integrate any third party library in your DI-enabled application
  • Use dependency injection when writing web applications
  • Implement Aspect Oriented Programming to handle common cross-cutting concerns such as logging, authentication and transactions.
  • Write integration tests for DI applications