Polishing

This commit is contained in:
Juergen Hoeller
2018-08-01 12:32:09 +02:00
parent ae6d778c3e
commit 92c210201e
3 changed files with 20 additions and 24 deletions

View File

@@ -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;
}