Remove APIs marked as deprecated for removal

Closes gh-33809
This commit is contained in:
Juergen Hoeller
2024-12-04 13:19:39 +01:00
parent 078d683f47
commit 2b9010c2a2
150 changed files with 141 additions and 5922 deletions

View File

@@ -171,30 +171,6 @@ public final class BeanInstanceSupplier<T> extends AutowiredElementResolver impl
return new BeanInstanceSupplier<>(this.lookup, generator, null, this.shortcutBeanNames);
}
/**
* Return a new {@link BeanInstanceSupplier} instance that uses the specified
* {@code generator} supplier to instantiate the underlying bean.
* @param generator a {@link ThrowingSupplier} to instantiate the underlying bean
* @return a new {@link BeanInstanceSupplier} instance with the specified generator
* @deprecated in favor of {@link #withGenerator(ThrowingFunction)}
*/
@Deprecated(since = "6.0.11", forRemoval = true)
public BeanInstanceSupplier<T> withGenerator(ThrowingSupplier<T> generator) {
Assert.notNull(generator, "'generator' must not be null");
return new BeanInstanceSupplier<>(this.lookup, registeredBean -> generator.get(),
null, this.shortcutBeanNames);
}
/**
* Return a new {@link BeanInstanceSupplier} instance
* that uses direct bean name injection shortcuts for specific parameters.
* @deprecated in favor of {@link #withShortcut(String...)}
*/
@Deprecated(since = "6.2", forRemoval = true)
public BeanInstanceSupplier<T> withShortcuts(String... beanNames) {
return withShortcut(beanNames);
}
/**
* Return a new {@link BeanInstanceSupplier} instance that uses
* direct bean name injection shortcuts for specific parameters.

View File

@@ -55,23 +55,6 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
return currentlyInvokedFactoryMethod.get();
}
/**
* Set the factory method currently being invoked or {@code null} to remove
* the current value, if any.
* @param method the factory method currently being invoked or {@code null}
* @since 6.0
* @deprecated in favor of {@link #instantiateWithFactoryMethod(Method, Supplier)}
*/
@Deprecated(since = "6.2", forRemoval = true)
public static void setCurrentlyInvokedFactoryMethod(@Nullable Method method) {
if (method != null) {
currentlyInvokedFactoryMethod.set(method);
}
else {
currentlyInvokedFactoryMethod.remove();
}
}
/**
* Invoke the given {@code instanceSupplier} with the factory method exposed
* as being invoked.

View File

@@ -62,7 +62,6 @@ import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.function.ThrowingBiFunction;
import org.springframework.util.function.ThrowingFunction;
import org.springframework.util.function.ThrowingSupplier;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -180,16 +179,6 @@ class BeanInstanceSupplierTests {
.withMessage("'generator' must not be null");
}
@Test
@Deprecated
@SuppressWarnings("removal")
void withGeneratorWhenSupplierIsNullThrowsException() {
BeanInstanceSupplier<Object> resolver = BeanInstanceSupplier.forConstructor();
assertThatIllegalArgumentException()
.isThrownBy(() -> resolver.withGenerator((ThrowingSupplier<Object>) null))
.withMessage("'generator' must not be null");
}
@Test
void getWithConstructorDoesNotSetResolvedFactoryMethod() {
BeanInstanceSupplier<SingleArgConstructor> resolver = BeanInstanceSupplier.forConstructor(String.class);
@@ -236,18 +225,6 @@ class BeanInstanceSupplierTests {
assertThat(resolver.get(registerBean)).isInstanceOf(String.class).isEqualTo("1");
}
@Test
@Deprecated
@SuppressWarnings("removal")
void getWithGeneratorCallsSupplier() {
BeanRegistrar registrar = new BeanRegistrar(SingleArgConstructor.class);
this.beanFactory.registerSingleton("one", "1");
RegisteredBean registerBean = registrar.registerBean(this.beanFactory);
BeanInstanceSupplier<String> resolver = BeanInstanceSupplier.<String>forConstructor(String.class)
.withGenerator(() -> "1");
assertThat(resolver.get(registerBean)).isInstanceOf(String.class).isEqualTo("1");
}
@Test
void getWhenRegisteredBeanIsNullThrowsException() {
BeanInstanceSupplier<Object> resolver = BeanInstanceSupplier.forConstructor(String.class);