From 3d39dfc4ce984ee2a23af7a420a66bfe0455f774 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 14 May 2022 18:35:58 +0200 Subject: [PATCH] Polishing --- .../annotation/AnnotationConfigApplicationContextTests.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java index 1e5c49f50af..adc78801766 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java @@ -152,16 +152,14 @@ class AnnotationConfigApplicationContextTests { context.getBeanFactory().addBeanPostProcessor(new BeanPostProcessor() { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) { - if (bean instanceof TestBean) { - TestBean testBean = (TestBean) bean; + if (bean instanceof TestBean testBean) { testBean.name = testBean.name + "-before"; } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) { - if (bean instanceof TestBean) { - TestBean testBean = (TestBean) bean; + if (bean instanceof TestBean testBean) { testBean.name = testBean.name + "-after"; } return bean;