From 398cc01650825d56adf1bdc8fbee8bf6006527db Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:24:55 +0100 Subject: [PATCH] Polishing --- .../spel/support/BeanFactoryTypeConverter.java | 9 +++------ .../result/view/ViewResolutionResultHandler.java | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/integration-tests/src/test/java/org/springframework/expression/spel/support/BeanFactoryTypeConverter.java b/integration-tests/src/test/java/org/springframework/expression/spel/support/BeanFactoryTypeConverter.java index b2800bb607a5..2a8974959d60 100644 --- a/integration-tests/src/test/java/org/springframework/expression/spel/support/BeanFactoryTypeConverter.java +++ b/integration-tests/src/test/java/org/springframework/expression/spel/support/BeanFactoryTypeConverter.java @@ -59,11 +59,9 @@ public void setConversionService(ConversionService conversionService) { @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - if (beanFactory instanceof ConfigurableBeanFactory) { - Object typeConverter = ((ConfigurableBeanFactory) beanFactory).getTypeConverter(); - if (typeConverter instanceof SimpleTypeConverter) { - delegate = (SimpleTypeConverter) typeConverter; - } + if (beanFactory instanceof ConfigurableBeanFactory cbf && + cbf.getTypeConverter() instanceof SimpleTypeConverter simpleTypeConverter) { + this.delegate = simpleTypeConverter; } } @@ -86,7 +84,6 @@ public boolean canConvert(TypeDescriptor sourceTypeDescriptor, TypeDescriptor ta if (conversionService.canConvert(sourceTypeDescriptor, targetTypeDescriptor)) { return true; } - // TODO: what does this mean? This method is not used in SpEL so probably ignorable? Class sourceType = sourceTypeDescriptor.getObjectType(); Class targetType = targetTypeDescriptor.getObjectType(); return canConvert(sourceType, targetType); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java index 4fb234642480..85f24c21de29 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java @@ -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. @@ -53,7 +53,7 @@ * {@code HandlerResultHandler} that encapsulates the view resolution algorithm * supporting the following return types: *