This example shows how we can customize RequiredAnnotationBeanPostProcessor in the @Configuration class to do dependency checking using @Required annotation.
@Bean
public RequiredAnnotationBeanPostProcessor processor () {
return new RequiredAnnotationBeanPostProcessor() {
@Override
protected boolean shouldSkip (ConfigurableListableBeanFactory beanFactory,
String beanName) {
if (beanName.equals("clientBean")) {
return false;
}
return super.shouldSkip(beanFactory, beanName);
}
};
}
Original Post