|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2023 the original author or authors. |
| 2 | + * Copyright 2002-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -58,16 +58,14 @@ public final class AutowiredFieldValueResolver extends AutowiredElementResolver
|
58 | 58 | private final boolean required;
|
59 | 59 |
|
60 | 60 | @Nullable
|
61 |
| - private final String shortcut; |
| 61 | + private final String shortcutBeanName; |
62 | 62 |
|
63 | 63 |
|
64 |
| - private AutowiredFieldValueResolver(String fieldName, boolean required, |
65 |
| - @Nullable String shortcut) { |
66 |
| - |
| 64 | + private AutowiredFieldValueResolver(String fieldName, boolean required, @Nullable String shortcut) { |
67 | 65 | Assert.hasText(fieldName, "'fieldName' must not be empty");
|
68 | 66 | this.fieldName = fieldName;
|
69 | 67 | this.required = required;
|
70 |
| - this.shortcut = shortcut; |
| 68 | + this.shortcutBeanName = shortcut; |
71 | 69 | }
|
72 | 70 |
|
73 | 71 |
|
@@ -97,7 +95,7 @@ public static AutowiredFieldValueResolver forRequiredField(String fieldName) {
|
97 | 95 | * direct bean name injection shortcut.
|
98 | 96 | * @param beanName the bean name to use as a shortcut
|
99 | 97 | * @return a new {@link AutowiredFieldValueResolver} instance that uses the
|
100 |
| - * shortcuts |
| 98 | + * given shortcut bean name |
101 | 99 | */
|
102 | 100 | public AutowiredFieldValueResolver withShortcut(String beanName) {
|
103 | 101 | return new AutowiredFieldValueResolver(this.fieldName, this.required, beanName);
|
@@ -178,8 +176,8 @@ private Object resolveValue(RegisteredBean registeredBean, Field field) {
|
178 | 176 | ConfigurableBeanFactory beanFactory = registeredBean.getBeanFactory();
|
179 | 177 | DependencyDescriptor descriptor = new DependencyDescriptor(field, this.required);
|
180 | 178 | descriptor.setContainingClass(beanClass);
|
181 |
| - if (this.shortcut != null) { |
182 |
| - descriptor = new ShortcutDependencyDescriptor(descriptor, this.shortcut); |
| 179 | + if (this.shortcutBeanName != null) { |
| 180 | + descriptor = new ShortcutDependencyDescriptor(descriptor, this.shortcutBeanName); |
183 | 181 | }
|
184 | 182 | Set<String> autowiredBeanNames = new LinkedHashSet<>(1);
|
185 | 183 | TypeConverter typeConverter = beanFactory.getTypeConverter();
|
|
0 commit comments