You cannot specify a parent bean for beans configured in java configuration simply because it is java and the @Bean methods are used as factory methods. You could create a factory method/callback method to which you pass your beans to do the common configuration (you might need to do a bit of reflection but it would work).
Code:
@Configuration
public class MyConfig {
@Autowired
private Object yourParent;
protected void configureBean(Object myBean) {
// copy matching properties from parent to myBean
// or simply retrieve and set the properties in the @Bean method
}
@Bean
public MyBean bean1() {
MyBean bean = new MyBean();
configureBean(bean);
bean.setProperty("value"):
return bean;
}
@Bean
public MyOtherBean bean2() {
MyOtherBean bean = new MyOtherBean ();
configureBean(bean);
bean.setYetAnotherProperty("other_value"):
return bean;
}
}