Skip to content

Commit ab30a70

Browse files
committed
Apply formatting
See gh-50831 Signed-off-by: yangzhice <a13644015167@qq.com>
1 parent d3f8884 commit ab30a70

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ public <T> T bindOrCreate(ConfigurationPropertyName name, Bindable<T> target, @N
494494
return result;
495495
}
496496

497-
498497
private boolean hasDescendantInAnySource(Context context, ConfigurationPropertyName name) {
499498
for (ConfigurationPropertySource source : context.getSources()) {
500499
if (source.containsDescendantOf(name) == ConfigurationPropertyState.PRESENT) {
@@ -515,12 +514,12 @@ private boolean hasDescendantInAnySource(Context context, ConfigurationPropertyN
515514
return null;
516515
}
517516
DataObjectPropertyBinder propertyBinder = (propertyName, propertyTarget) -> {
518-
ConfigurationPropertyName fullName = name.append(propertyName);
519-
ConfigurationProperty property = findProperty(fullName, propertyTarget, context);
520-
boolean fromSource = (property != null) || hasDescendantInAnySource(context, fullName);
521-
Object value = bind(fullName, propertyTarget, handler, context, false, false);
522-
return new DataObjectPropertyBinder.PropertyBinding(value, fromSource);
523-
};
517+
ConfigurationPropertyName fullName = name.append(propertyName);
518+
ConfigurationProperty property = findProperty(fullName, propertyTarget, context);
519+
boolean fromSource = (property != null) || hasDescendantInAnySource(context, fullName);
520+
Object value = bind(fullName, propertyTarget, handler, context, false, false);
521+
return new DataObjectPropertyBinder.PropertyBinding(value, fromSource);
522+
};
524523
Supplier<@Nullable Object> supplier = () -> fromDataObjectBinders(bindMethod,
525524
(dataObjectBinder) -> dataObjectBinder.bind(name, target, context, propertyBinder,
526525
fallbackToDefaultValue));

core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/JavaBeanBinderTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,6 @@ public String toString() {
12781278

12791279
}
12801280

1281-
12821281
@Test
12831282
void bindToListWithOptionalFieldAndNonIterableSourceShouldNotLoopInfinitely() {
12841283
ConfigurationPropertySource source = new ConfigurationPropertySource() {
@@ -1289,7 +1288,7 @@ void bindToListWithOptionalFieldAndNonIterableSourceShouldNotLoopInfinitely() {
12891288
};
12901289
this.sources.add(source);
12911290
assertThatCode(() -> this.binder.bind("foo", Bindable.of(ListOfOptionalExample.class)))
1292-
.doesNotThrowAnyException();
1291+
.doesNotThrowAnyException();
12931292
}
12941293

12951294
@Test
@@ -1351,5 +1350,4 @@ void setOptionalValue(Optional<String> optionalValue) {
13511350

13521351
}
13531352

1354-
13551353
}

0 commit comments

Comments
 (0)