Skip to content

Commit 90268de

Browse files
committed
Polish implementation of BeanDefinitionReaderUtils.generateBeanName()
Closes gh-24739
1 parent 2ca93cb commit 90268de

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,13 @@ else if (definition.getFactoryBeanName() != null) {
118118
"'class' nor 'parent' nor 'factory-bean' - can't generate bean name");
119119
}
120120

121-
String id = generatedBeanName;
122121
if (isInnerBean) {
123122
// Inner bean: generate identity hashcode suffix.
124-
id = generatedBeanName + GENERATED_BEAN_NAME_SEPARATOR + ObjectUtils.getIdentityHexString(definition);
123+
return generatedBeanName + GENERATED_BEAN_NAME_SEPARATOR + ObjectUtils.getIdentityHexString(definition);
125124
}
126-
else {
127-
// Top-level bean: use plain class name with unique suffix if necessary.
128-
return uniqueBeanName(generatedBeanName, registry);
129-
}
130-
return id;
125+
126+
// Top-level bean: use plain class name with unique suffix if necessary.
127+
return uniqueBeanName(generatedBeanName, registry);
131128
}
132129

133130
/**

0 commit comments

Comments
 (0)