https://grokonez.com/spring-framework/spring-bean-definition-inheritance-spring-boot
Spring Bean Definition Inheritance | Spring Boot
Bean Definition Inheritance is a good solution for defining new bean which inherited certain bean conveniently.
We will learn how to use XML configuration to create Inheritance from Bean with parent or abstract template.
Click Next, in Web: choose Web:
Click Finish. Spring Boot project will be created successfully.
public class CustomerService {
private String welcomeMessage;
private String customerName;
public String getWelcomeMessage() {
return welcomeMessage;
}
public void setWelcomeMessage(String welcomeMessage) {
this.welcomeMessage = welcomeMessage;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String sayHello() {
return welcomeMessage + " " + customerName;
}
}
Content of SpecificService.java:
More at:
https://grokonez.com/spring-framework/spring-bean-definition-inheritance-spring-boot
Spring Bean Definition Inheritance | Spring Boot
#spring-bean #springboot #inheritance