Declare isStatic and releaseTarget as default methods on TargetSource

Closes gh-31820
This commit is contained in:
Juergen Hoeller
2023-12-12 12:39:52 +01:00
parent eae53560e4
commit 6bb9775309
11 changed files with 14 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@@ -85,7 +85,7 @@ public class ContextAnnotationAutowireCandidateResolver extends QualifierAnnotat
}
private Object buildLazyResolutionProxy(
final DependencyDescriptor descriptor, final @Nullable String beanName, boolean classOnly) {
final DependencyDescriptor descriptor, @Nullable final String beanName, boolean classOnly) {
BeanFactory beanFactory = getBeanFactory();
Assert.state(beanFactory instanceof DefaultListableBeanFactory,
@@ -98,10 +98,6 @@ public class ContextAnnotationAutowireCandidateResolver extends QualifierAnnotat
return descriptor.getDependencyType();
}
@Override
public boolean isStatic() {
return false;
}
@Override
public Object getTarget() {
Set<String> autowiredBeanNames = (beanName != null ? new LinkedHashSet<>(1) : null);
Object target = dlbf.doResolveDependency(descriptor, beanName, autowiredBeanNames, null);
@@ -128,9 +124,6 @@ public class ContextAnnotationAutowireCandidateResolver extends QualifierAnnotat
}
return target;
}
@Override
public void releaseTarget(Object target) {
}
};
ProxyFactory pf = new ProxyFactory();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2023 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.
@@ -148,8 +148,4 @@ public class JndiObjectTargetSource extends JndiObjectLocator implements TargetS
}
}
@Override
public void releaseTarget(Object target) {
}
}