diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java index 6494d931a2a..646b02aebb4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java @@ -22,14 +22,12 @@ import java.util.List; import java.util.Objects; import java.util.Set; -import org.springframework.aot.generate.GenerationContext; import org.springframework.aot.hint.MemberCategory; import org.springframework.aot.hint.TypeReference; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution; import org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor; -import org.springframework.beans.factory.aot.BeanFactoryInitializationCode; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; @@ -121,26 +119,19 @@ class ServletComponentRegisteringPostProcessor @Override public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) { - return new BeanFactoryInitializationAotContribution() { - - @Override - public void applyTo(GenerationContext generationContext, - BeanFactoryInitializationCode beanFactoryInitializationCode) { - for (String beanName : beanFactory.getBeanDefinitionNames()) { - BeanDefinition definition = beanFactory.getBeanDefinition(beanName); - if (Objects.equals(definition.getBeanClassName(), - WebListenerHandler.ServletComponentWebListenerRegistrar.class.getName())) { - String listenerClassName = (String) definition.getConstructorArgumentValues() - .getArgumentValue(0, String.class) - .getValue(); - generationContext.getRuntimeHints() - .reflection() - .registerType(TypeReference.of(listenerClassName), - MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); - } + return (generationContext, beanFactoryInitializationCode) -> { + for (String beanName : beanFactory.getBeanDefinitionNames()) { + BeanDefinition definition = beanFactory.getBeanDefinition(beanName); + if (Objects.equals(definition.getBeanClassName(), + WebListenerHandler.ServletComponentWebListenerRegistrar.class.getName())) { + String listenerClassName = (String) definition.getConstructorArgumentValues() + .getArgumentValue(0, String.class) + .getValue(); + generationContext.getRuntimeHints() + .reflection() + .registerType(TypeReference.of(listenerClassName), MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); } } - }; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java index d1a615718cc..761cfbb17cd 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java @@ -321,12 +321,12 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry, Ordered { } @Override - public void sendError(int status) throws IOException { + public void sendError(int status) { sendError(status, null); } @Override - public void sendError(int status, String message) throws IOException { + public void sendError(int status, String message) { this.status = status; this.message = message; this.hasErrorToSend = true;