|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2023 the original author or authors. |
| 2 | + * Copyright 2012-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
17 | 17 | package org.springframework.boot.context.properties;
|
18 | 18 |
|
19 | 19 | import org.springframework.beans.factory.BeanFactory;
|
20 |
| -import org.springframework.beans.factory.HierarchicalBeanFactory; |
21 | 20 | import org.springframework.beans.factory.ListableBeanFactory;
|
22 | 21 | import org.springframework.beans.factory.config.BeanDefinition;
|
23 | 22 | import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
@@ -68,18 +67,8 @@ private String getName(Class<?> type, MergedAnnotation<ConfigurationProperties>
|
68 | 67 | }
|
69 | 68 |
|
70 | 69 | private boolean containsBeanDefinition(String name) {
|
71 |
| - return containsBeanDefinition(this.beanFactory, name); |
72 |
| - } |
73 |
| - |
74 |
| - private boolean containsBeanDefinition(BeanFactory beanFactory, String name) { |
75 |
| - if (beanFactory instanceof ListableBeanFactory listableBeanFactory |
76 |
| - && listableBeanFactory.containsBeanDefinition(name)) { |
77 |
| - return true; |
78 |
| - } |
79 |
| - if (beanFactory instanceof HierarchicalBeanFactory hierarchicalBeanFactory) { |
80 |
| - return containsBeanDefinition(hierarchicalBeanFactory.getParentBeanFactory(), name); |
81 |
| - } |
82 |
| - return false; |
| 70 | + return (this.beanFactory instanceof ListableBeanFactory listableBeanFactory |
| 71 | + && listableBeanFactory.containsBeanDefinition(name)); |
83 | 72 | }
|
84 | 73 |
|
85 | 74 | private void registerBeanDefinition(String beanName, Class<?> type,
|
|
0 commit comments