diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java index 1c843b5d649c..8a045036da32 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java @@ -72,8 +72,8 @@ public int getOrder() { @Override public void onApplicationEvent(ContextRefreshedEvent event) { ApplicationContext context = event.getApplicationContext(); - if (context instanceof ConfigurableApplicationContext && context == event.getSource()) { - context.publishEvent(new ParentContextAvailableEvent((ConfigurableApplicationContext) context)); + if (context instanceof ConfigurableApplicationContext configurableApplicationContext && context == event.getSource()) { + context.publishEvent(new ParentContextAvailableEvent(configurableApplicationContext)); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java index 9c15b6290bdb..9aa390f1f6c9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java @@ -201,9 +201,8 @@ private void flatten(Properties properties, Map input, String pa // Need a compound key flatten(properties, (Map) value, name); } - else if (value instanceof Collection) { + else if (value instanceof Collection collection) { // Need a compound key - Collection collection = (Collection) value; properties.put(name, StringUtils.collectionToCommaDelimitedString(collection)); int count = 0; for (Object item : collection) {