Book Image

SPRING COOKBOOK

Book Image

SPRING COOKBOOK

Overview of this book

Table of Contents (19 chapters)
Spring Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 2. Defining Beans and Using Dependency Injection

In this chapter, we will cover the following recipes:

  • Defining a bean explicitly with @Bean

  • Defining a bean implicitly with @Component

  • Using a bean via dependency injection with @Autowired

  • Using a bean directly

  • Listing all beans

  • Using multiple configuration classes