In Spring, how to implement inheritance in bean definition?

Answered

In Spring, how to implement inheritance in bean definition?

Ninja Asked on 17th September 2018 in Spring.
Add Comment
1 Answer(s)
Best answer

A Spring bean can inherit from another Spring bean through parent attribute on the child bean. The child bean will inherit all configuration information like constructor arguments, property values and container specific information. The inheritance concept is very similar to Java inheritance whereby the child can override some values and add some more if needed. However Spring does not enforce Java inheritance for the classes that are configured as parent child through spring configurations.

Ninja Answered on 17th September 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.