In Spring, how to implement inheritance in bean definition?
Answered
In Spring, how to implement inheritance in bean definition?
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.