Merge branch '6.2.x'

# Conflicts:
#	framework-platform/framework-platform.gradle
#	spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java
This commit is contained in:
Juergen Hoeller
2025-07-13 16:36:02 +02:00
6 changed files with 13 additions and 5 deletions
@@ -131,6 +131,7 @@ final class ConfigurationClass {
* @param metadata the metadata for the underlying class to represent
* @param beanName name of the {@code @Configuration} class bean
* @param scanned whether the underlying class has been registered through a scan
* @since 6.2
*/
ConfigurationClass(AnnotationMetadata metadata, String beanName, boolean scanned) {
Assert.notNull(beanName, "Bean name must not be null");
@@ -195,14 +195,14 @@ class ConfigurationClassBeanDefinitionReader {
AnnotationAttributes bean = AnnotationConfigUtils.attributesFor(metadata, Bean.class);
Assert.state(bean != null, "No @Bean annotation attributes");
// Consider name and any aliases
// Consider name and any aliases.
String[] explicitNames = bean.getStringArray("name");
String beanName;
String localBeanName;
if (explicitNames.length > 0 && StringUtils.hasText(explicitNames[0])) {
beanName = explicitNames[0];
localBeanName = beanName;
// Register aliases even when overridden below
// Register aliases even when overridden below.
for (int i = 1; i < explicitNames.length; i++) {
this.registry.registerAlias(beanName, explicitNames[i]);
}