I create a subclass from AbstractBeanFactoryAwareAdvisingPostProcessor ,and return it as a bean,properties refresh will not working for the bean that annotations with @ConfigurationProperties; my class like below: public class RequestLoggingPostProcessor extends AbstractBeanFactoryAwareAdvisingPostProcessor implements InitializingBean { private static final long serialVersionUID = 419979405639137668L; private final Class<? extends Annotation> classLevelAnnotationType = RequestLogging.class; private final Class<? extends Annotation> methodLevelAnnotationType = SystemLogger.class;
@Override
public void afterPropertiesSet() {
Pointcut pointcut = new AnnotationMatchingPointcut(this.classLevelAnnotationType, this.methodLevelAnnotationType, true);
this.advisor = new DefaultPointcutAdvisor(pointcut, new RequestLoggingInterceptor());
}
} and @Bean public RequestLoggingPostProcessor requestLoggingPostProcessor(Environment environment){ boolean proxyTargetClass = environment.getProperty("spring.aop.proxy-target-class", Boolean.class, true); RequestLoggingPostProcessor requestLoggingPostProcessor = new RequestLoggingPostProcessor(); requestLoggingPostProcessor.setProxyTargetClass(proxyTargetClass); return requestLoggingPostProcessor; } ;if I add this bean to environment,refresh properties like a.key is fine,I mean get this from environment.getProperty("a.key") is fine ,but the bean properties will not refresh(get properties from the bean,like getKey()),the bean like below: @Data @ConfigurationProperties(prefix = "a") public class BeanProperties{ private String key; }
Comment From: esotericman
If I remove RequestLoggingPostProcessor bean,everything is fine,what is wrong with it
Comment From: esotericman
It's a BFPP matter,I deal with it