Browse Source

Merge branch '6.1.x'

pull/32318/head
Juergen Hoeller 2 years ago
parent
commit
ad2e95be4b
  1. 2
      spring-context/src/main/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskScheduler.java
  2. 16
      spring-context/src/test/java/org/springframework/context/generator/ApplicationContextAotGeneratorRuntimeHintsTests.java

2
spring-context/src/main/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskScheduler.java

@ -192,7 +192,7 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements @@ -192,7 +192,7 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements
}
private Runnable scheduledTask(Runnable task) {
return () -> execute(task);
return () -> execute(new DelegatingErrorHandlingRunnable(task, TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
}
private Runnable taskOnSchedulerThread(Runnable task) {

16
spring-context/src/test/java/org/springframework/context/generator/ApplicationContextAotGeneratorRuntimeHintsTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@ -59,8 +59,8 @@ class ApplicationContextAotGeneratorRuntimeHintsTests { @@ -59,8 +59,8 @@ class ApplicationContextAotGeneratorRuntimeHintsTests {
void generateApplicationContextWithAutowiring() {
GenericApplicationContext context = new AnnotationConfigApplicationContext();
context.registerBeanDefinition("autowiredComponent", new RootBeanDefinition(AutowiredComponent.class));
context.registerBeanDefinition("number", BeanDefinitionBuilder.rootBeanDefinition(Integer.class, "valueOf")
.addConstructorArgValue("42").getBeanDefinition());
context.registerBeanDefinition("number", BeanDefinitionBuilder.rootBeanDefinition(
Integer.class, "valueOf").addConstructorArgValue("42").getBeanDefinition());
compile(context, (hints, invocations) -> assertThat(invocations).match(hints));
}
@ -89,8 +89,10 @@ class ApplicationContextAotGeneratorRuntimeHintsTests { @@ -89,8 +89,10 @@ class ApplicationContextAotGeneratorRuntimeHintsTests {
compile(context, (hints, invocations) -> assertThat(invocations).match(hints));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private void compile(GenericApplicationContext applicationContext, BiConsumer<RuntimeHints, RuntimeHintsInvocations> initializationResult) {
@SuppressWarnings({"rawtypes", "unchecked"})
private void compile(GenericApplicationContext applicationContext,
BiConsumer<RuntimeHints, RuntimeHintsInvocations> initializationResult) {
ApplicationContextAotGenerator generator = new ApplicationContextAotGenerator();
TestGenerationContext generationContext = new TestGenerationContext();
generator.processAheadOfTime(applicationContext, generationContext);
@ -107,17 +109,15 @@ class ApplicationContextAotGeneratorRuntimeHintsTests { @@ -107,17 +109,15 @@ class ApplicationContextAotGeneratorRuntimeHintsTests {
});
}
public interface Destroyable {
@PreDestroy
default void destroy() {
}
}
public static class InheritedDestroy implements Destroyable {
}
}

Loading…
Cancel
Save