Dependency Injection

The previous chapter gave us an overview of what Spring framework is, and how it helps developers to make development faster and easier. However, the question, "How to use the framework?" is still unanswered. In this chapter, we will discuss the question in all perspectives, and try to find out all probable answers for it. The chapter is full of configurations and alternatives to the configurations. It all depends on how the developer looks forward with these solutions in the available conditions and environmental setup of the application. We aim to cover the following points in depth:

  • Bean life cycle management with custom initialization, InitializingBean, DisposableBean, and Aware Interfaces, and the use of annotations such as @PostConstruct and @PreDestroy in the bean life cycle
  • The dependency injection
  • The setter and constructor dependency injection
  • Dependency injection for references, inner beans, inheritance, and collection
  • Bean scope and configuring scopes as singleton or prototype
  • Autowiring and ways of achieving autowiring
  • Problems occurring while autowiring and ways to overcome it

There's a lot of things to cover, so let's start with the very first--the life of a bean.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.77.71