Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3. Advanced bean wiring > Declaring parent and child beans

3.1. Declaring parent and child beans

One of the essentials of object-oriented programming is the ability to create a class that extends another class. The new class inherits many of the properties and methods of the parent class, but is able to introduce new properties and methods or even override the parent’s properties and methods. If you’re reading this book, you’re probably a Java programmer and subclassing is old news to you. But did you know that your Spring beans can “sub-bean” other Spring beans?

A <bean> declaration in Spring is typically defined with a class attribute to indicate the type of the bean and zero or more <property> elements to inject values into the bean’s properties. Everything about the <bean> is declared in one place.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint