Avoid synthesizable annotation creation for @Bean/@Scope on scanning
Includes consistent (non-)use of AnnotationUtils/AnnotatedElementUtils. Issue: SPR-16933
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -36,13 +36,14 @@ class BeanAnnotationHelper {
|
||||
public static String determineBeanNameFor(Method beanMethod) {
|
||||
// By default, the bean name is the name of the @Bean-annotated method
|
||||
String beanName = beanMethod.getName();
|
||||
|
||||
// Check to see if the user has explicitly set a custom bean name...
|
||||
Bean bean = AnnotatedElementUtils.findMergedAnnotation(beanMethod, Bean.class);
|
||||
if (bean != null && bean.name().length > 0) {
|
||||
beanName = bean.name()[0];
|
||||
if (bean != null) {
|
||||
String[] names = bean.name();
|
||||
if (names.length > 0) {
|
||||
beanName = names[0];
|
||||
}
|
||||
}
|
||||
|
||||
return beanName;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user