Skip to content

Commit

Permalink
Avoid bean override with CachingMetadataReaderFactoryPostProcessor
Browse files Browse the repository at this point in the history
Closes gh-28705
  • Loading branch information
snicoll committed Nov 16, 2021
1 parent 08e9725 commit f1991d8
Showing 1 changed file with 7 additions and 5 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -99,10 +99,12 @@ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) t
}

private void register(BeanDefinitionRegistry registry) {
BeanDefinition definition = BeanDefinitionBuilder
.genericBeanDefinition(SharedMetadataReaderFactoryBean.class, SharedMetadataReaderFactoryBean::new)
.getBeanDefinition();
registry.registerBeanDefinition(BEAN_NAME, definition);
if (!registry.containsBeanDefinition(BEAN_NAME)) {
BeanDefinition definition = BeanDefinitionBuilder
.rootBeanDefinition(SharedMetadataReaderFactoryBean.class, SharedMetadataReaderFactoryBean::new)
.getBeanDefinition();
registry.registerBeanDefinition(BEAN_NAME, definition);
}
}

private void configureConfigurationClassPostProcessor(BeanDefinitionRegistry registry) {
Expand Down

0 comments on commit f1991d8

Please sign in to comment.