Improve @Autowired method injection on mixed nullability args

See gh-17215
This commit is contained in:
陈其苗
2020-03-25 10:26:05 +08:00
committed by Stephane Nicoll
parent c8169e5cad
commit 32c0540424
2 changed files with 53 additions and 1 deletions

View File

@@ -865,7 +865,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
descriptors[i] = currDesc;
try {
Object arg = beanFactory.resolveDependency(currDesc, beanName, autowiredBeanNames, typeConverter);
if (arg == null && !this.required) {
if (arg == null && !this.required && !methodParam.isOptional()) {
arguments = null;
break;
}