Skip to content

Commit

Permalink
Remove APIs marked as deprecated for removal
Browse files Browse the repository at this point in the history
Closes gh-33809
  • Loading branch information
jhoeller committed Dec 4, 2024
1 parent 078d683 commit 2b9010c
Show file tree
Hide file tree
Showing 150 changed files with 137 additions and 5,918 deletions.
7 changes: 3 additions & 4 deletions framework-docs/modules/ROOT/pages/web/webflux/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -647,13 +647,12 @@ For https://www.webjars.org/documentation[WebJars], versioned URLs like
`/webjars/jquery/1.2.0/jquery.min.js` are the recommended and most efficient way to use them.
The related resource location is configured out of the box with Spring Boot (or can be configured
manually via `ResourceHandlerRegistry`) and does not require to add the
`org.webjars:webjars-locator-core` dependency.
`org.webjars:webjars-locator-lite` dependency.

Version-less URLs like `/webjars/jquery/jquery.min.js` are supported through the
`WebJarsResourceResolver` which is automatically registered when the
`org.webjars:webjars-locator-core` library is present on the classpath, at the cost of a
classpath scanning that could slow down application startup. The resolver can re-write URLs to
include the version of the jar and can also match against incoming URLs without versions
`org.webjars:webjars-locator-lite` library is present on the classpath. The resolver can re-write
URLs to include the version of the jar and can also match against incoming URLs without versions
-- for example, from `/webjars/jquery/jquery.min.js` to `/webjars/jquery/1.2.0/jquery.min.js`.

TIP: The Java configuration based on `ResourceHandlerRegistry` provides further options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ For https://www.webjars.org/documentation[WebJars], versioned URLs like
`/webjars/jquery/1.2.0/jquery.min.js` are the recommended and most efficient way to use them.
The related resource location is configured out of the box with Spring Boot (or can be configured
manually via `ResourceHandlerRegistry`) and does not require to add the
`org.webjars:webjars-locator-core` dependency.
`org.webjars:webjars-locator-lite` dependency.

Version-less URLs like `/webjars/jquery/jquery.min.js` are supported through the
`WebJarsResourceResolver` which is automatically registered when the
`org.webjars:webjars-locator-core` library is present on the classpath, at the cost of a
classpath scanning that could slow down application startup. The resolver can re-write URLs to
include the version of the jar and can also match against incoming URLs without versions
`org.webjars:webjars-locator-lite` library is present on the classpath. The resolver can re-write
URLs to include the version of the jar and can also match against incoming URLs without versions
-- for example, from `/webjars/jquery/jquery.min.js` to `/webjars/jquery/1.2.0/jquery.min.js`.

TIP: The Java configuration based on `ResourceHandlerRegistry` provides further options
Expand Down
2 changes: 0 additions & 2 deletions framework-platform/framework-platform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ dependencies {
api("com.oracle.database.jdbc:ojdbc11:21.9.0.0")
api("com.rometools:rome:1.19.0")
api("com.squareup.okhttp3:mockwebserver:3.14.9")
api("com.squareup.okhttp3:okhttp:3.14.9")
api("com.sun.activation:jakarta.activation:2.0.1")
api("com.sun.xml.bind:jaxb-core:3.0.2")
api("com.sun.xml.bind:jaxb-impl:3.0.2")
Expand Down Expand Up @@ -142,7 +141,6 @@ dependencies {
api("org.slf4j:slf4j-api:2.0.16")
api("org.testng:testng:7.10.2")
api("org.webjars:underscorejs:1.8.3")
api("org.webjars:webjars-locator-core:0.55")
api("org.webjars:webjars-locator-lite:1.0.0")
api("org.xmlunit:xmlunit-assertj:2.10.0")
api("org.xmlunit:xmlunit-matchers:2.10.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,11 @@ protected Executor getDefaultExecutor(@Nullable BeanFactory beanFactory) {
* @param returnType the declared return type (potentially a {@link Future} variant)
* @return the execution result (potentially a corresponding {@link Future} handle)
*/
@SuppressWarnings("removal")
@Nullable
protected Object doSubmit(Callable<Object> task, AsyncTaskExecutor executor, Class<?> returnType) {
if (CompletableFuture.class.isAssignableFrom(returnType)) {
return executor.submitCompletable(task);
}
else if (org.springframework.util.concurrent.ListenableFuture.class.isAssignableFrom(returnType)) {
return ((org.springframework.core.task.AsyncListenableTaskExecutor) executor).submitListenable(task);
}
else if (Future.class.isAssignableFrom(returnType)) {
return executor.submit(task);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.concurrent.ListenableFuture;

import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING;
Expand Down Expand Up @@ -136,10 +135,7 @@ void qualifiedAsyncMethodsAreRoutedToCorrectExecutor() throws InterruptedExcepti
assertThat(defaultThread.get()).isNotEqualTo(Thread.currentThread());
assertThat(defaultThread.get().getName()).doesNotStartWith("e1-");

ListenableFuture<Thread> e1Thread = obj.e1Work();
assertThat(e1Thread.get().getName()).startsWith("e1-");

CompletableFuture<Thread> e1OtherThread = obj.e1OtherWork();
CompletableFuture<Thread> e1OtherThread = obj.e1Work();
assertThat(e1OtherThread.get().getName()).startsWith("e1-");
}

Expand Down Expand Up @@ -269,12 +265,7 @@ public Future<Thread> defaultWork() {
}

@Async("e1")
public ListenableFuture<Thread> e1Work() {
return new AsyncResult<>(Thread.currentThread());
}

@Async("e1")
public CompletableFuture<Thread> e1OtherWork() {
public CompletableFuture<Thread> e1Work() {
return CompletableFuture.completedFuture(Thread.currentThread());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,30 +171,6 @@ public BeanInstanceSupplier<T> withGenerator(ThrowingFunction<RegisteredBean, T>
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,6 @@ public static Method getCurrentlyInvokedFactoryMethod() {
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
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;
Expand Down Expand Up @@ -180,16 +179,6 @@ void withGeneratorWhenFunctionIsNullThrowsException() {
.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);
Expand Down Expand Up @@ -236,18 +225,6 @@ void getWithGeneratorCallsFunction() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.task.AsyncListenableTaskExecutor;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.SchedulingException;
import org.springframework.scheduling.SchedulingTaskExecutor;
import org.springframework.util.Assert;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureTask;

/**
* Subclass of Quartz's SimpleThreadPool that implements Spring's
Expand All @@ -47,9 +45,9 @@
* @see org.springframework.core.task.TaskExecutor
* @see SchedulerFactoryBean#setTaskExecutor
*/
@SuppressWarnings({"deprecation", "removal"})
@SuppressWarnings("deprecation")
public class SimpleThreadPoolTaskExecutor extends SimpleThreadPool
implements AsyncListenableTaskExecutor, SchedulingTaskExecutor, InitializingBean, DisposableBean {
implements AsyncTaskExecutor, SchedulingTaskExecutor, InitializingBean, DisposableBean {

private boolean waitForJobsToCompleteOnShutdown = false;

Expand Down Expand Up @@ -91,20 +89,6 @@ public <T> Future<T> submit(Callable<T> task) {
return future;
}

@Override
public ListenableFuture<?> submitListenable(Runnable task) {
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null);
execute(future);
return future;
}

@Override
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
ListenableFutureTask<T> future = new ListenableFutureTask<>(task);
execute(future);
return future;
}


@Override
public void destroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ protected Object[] resolveArguments(ApplicationEvent event) {
return new Object[] {event};
}

@SuppressWarnings({"removal", "unchecked", "deprecation"})
protected void handleResult(Object result) {
if (reactiveStreamsPresent && new ReactiveResultHandler().subscribeToPublisher(result)) {
if (logger.isTraceEnabled()) {
Expand All @@ -327,9 +326,6 @@ else if (event != null) {
}
});
}
else if (result instanceof org.springframework.util.concurrent.ListenableFuture<?> listenableFuture) {
listenableFuture.addCallback(this::publishEvents, this::handleAsyncError);
}
else {
publishEvents(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
import java.util.concurrent.TimeUnit;

import org.springframework.lang.Nullable;
import org.springframework.util.concurrent.FailureCallback;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureCallback;
import org.springframework.util.concurrent.SuccessCallback;

/**
* A pass-through {@code Future} handle that can be used for method signatures
Expand All @@ -46,8 +42,7 @@
* @deprecated as of 6.0, in favor of {@link CompletableFuture}
*/
@Deprecated(since = "6.0")
@SuppressWarnings("removal")
public class AsyncResult<V> implements ListenableFuture<V> {
public class AsyncResult<V> implements Future<V> {

@Nullable
private final V value;
Expand Down Expand Up @@ -105,46 +100,14 @@ public V get(long timeout, TimeUnit unit) throws ExecutionException {
return get();
}

@Override
public void addCallback(ListenableFutureCallback<? super V> callback) {
addCallback(callback, callback);
}

@Override
public void addCallback(SuccessCallback<? super V> successCallback, FailureCallback failureCallback) {
try {
if (this.executionException != null) {
failureCallback.onFailure(exposedException(this.executionException));
}
else {
successCallback.onSuccess(this.value);
}
}
catch (Throwable ex) {
// Ignore
}
}

@Override
public CompletableFuture<V> completable() {
if (this.executionException != null) {
CompletableFuture<V> completable = new CompletableFuture<>();
completable.completeExceptionally(exposedException(this.executionException));
return completable;
}
else {
return CompletableFuture.completedFuture(this.value);
}
}


/**
* Create a new async result which exposes the given value from {@link Future#get()}.
* @param value the value to expose
* @since 4.2
* @see Future#get()
*/
public static <V> org.springframework.util.concurrent.ListenableFuture<V> forValue(V value) {
public static <V> Future<V> forValue(V value) {
return new AsyncResult<>(value, null);
}

Expand All @@ -156,7 +119,7 @@ public static <V> org.springframework.util.concurrent.ListenableFuture<V> forVal
* @since 4.2
* @see ExecutionException
*/
public static <V> org.springframework.util.concurrent.ListenableFuture<V> forExecutionException(Throwable ex) {
public static <V> Future<V> forExecutionException(Throwable ex) {
return new AsyncResult<>(null, ex);
}

Expand Down
Loading

0 comments on commit 2b9010c

Please sign in to comment.