Apply instanceof pattern matching
See gh-42049
This commit is contained in:
@@ -72,8 +72,9 @@ public class ParentContextApplicationContextInitializer
|
||||
@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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -201,9 +201,8 @@ public class CloudFoundryVcapEnvironmentPostProcessor implements EnvironmentPost
|
||||
// Need a compound key
|
||||
flatten(properties, (Map<String, Object>) value, name);
|
||||
}
|
||||
else if (value instanceof Collection) {
|
||||
else if (value instanceof Collection<?> collection) {
|
||||
// Need a compound key
|
||||
Collection<Object> collection = (Collection<Object>) value;
|
||||
properties.put(name, StringUtils.collectionToCommaDelimitedString(collection));
|
||||
int count = 0;
|
||||
for (Object item : collection) {
|
||||
|
||||
Reference in New Issue
Block a user