File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
spring-context/src/main/java/org/springframework/context/support Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -679,6 +679,13 @@ protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactor
679679 */
680680 protected void invokeBeanFactoryPostProcessors (ConfigurableListableBeanFactory beanFactory ) {
681681 PostProcessorRegistrationDelegate .invokeBeanFactoryPostProcessors (beanFactory , getBeanFactoryPostProcessors ());
682+
683+ // Detect a LoadTimeWeaver and prepare for weaving, if found in the meantime
684+ // (e.g. through an @Bean method registered by ConfigurationClassPostProcessor)
685+ if (beanFactory .getTempClassLoader () == null && beanFactory .containsBean (LOAD_TIME_WEAVER_BEAN_NAME )) {
686+ beanFactory .addBeanPostProcessor (new LoadTimeWeaverAwareProcessor (beanFactory ));
687+ beanFactory .setTempClassLoader (new ContextTypeMatchClassLoader (beanFactory .getBeanClassLoader ()));
688+ }
682689 }
683690
684691 /**
You can’t perform that action at this time.
0 commit comments