From 341f4882ed9026661d8c2818dc90c9c84b1e69e1 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Wed, 28 Nov 2018 12:21:21 +0100 Subject: [PATCH 1/2] Clarify behaviour of AnnotationBeanNameGenerator with acronyms Name transformation is delegated to Introspector#decapitalize, which states "but in the (unusual) special case when there is more than one character and both the first and second characters are upper case, we leave it alone.". This commit clarifies this behavior. See gh-2030 --- .../context/annotation/AnnotationBeanNameGenerator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java index 4beee868064..bb13d3944a1 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java @@ -47,10 +47,11 @@ import org.springframework.util.StringUtils; * *

If the annotation's value doesn't indicate a bean name, an appropriate * name will be built based on the short name of the class (with the first - * letter lower-cased). For example: + * letter lower-cased). If two first letters of class name are uppercase, bean name will be unchanged. For example: * *

com.xyz.FooServiceImpl -> fooServiceImpl
- * + *
com.xyz.URLFooServiceImpl -> URLFooServiceImpl
+ * * @author Juergen Hoeller * @author Mark Fisher * @since 2.5 From a1b2695c3a24017c258515faf84041420dd9f6d6 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 24 Nov 2021 16:00:11 +0100 Subject: [PATCH 2/2] Polish "Clarify behaviour of AnnotationBeanNameGenerator with acronyms" See gh-2030 --- .../context/annotation/AnnotationBeanNameGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java index bb13d3944a1..54ac7379e75 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-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. @@ -47,7 +47,7 @@ import org.springframework.util.StringUtils; * *

If the annotation's value doesn't indicate a bean name, an appropriate * name will be built based on the short name of the class (with the first - * letter lower-cased). If two first letters of class name are uppercase, bean name will be unchanged. For example: + * letter lower-cased), unless the two first letters are uppercase. For example: * *

com.xyz.FooServiceImpl -> fooServiceImpl
*
com.xyz.URLFooServiceImpl -> URLFooServiceImpl