@@ -209,6 +209,9 @@ private <T> T handleBindResult(ConfigurationPropertyName name, Bindable<T> targe
209
209
result = handler .onSuccess (name , target , context , result );
210
210
result = convert (result , target );
211
211
}
212
+ else {
213
+ result = handler .onNull (name , target , context );
214
+ }
212
215
handler .onFinish (name , target , context , result );
213
216
return convert (result , target );
214
217
}
@@ -237,9 +240,6 @@ private <T> T convert(Object value, Bindable<T> target) {
237
240
private <T > Object bindObject (ConfigurationPropertyName name , Bindable <T > target ,
238
241
BindHandler handler , Context context ) throws Exception {
239
242
ConfigurationProperty property = findProperty (name , context );
240
- if (property == null && containsNoDescendantOf (context .streamSources (), name )) {
241
- return null ;
242
- }
243
243
AggregateBinder <?> aggregateBinder = getAggregateBinder (target , context );
244
244
if (aggregateBinder != null ) {
245
245
return bindAggregate (name , target , handler , context , aggregateBinder );
@@ -292,8 +292,7 @@ private <T> Object bindProperty(ConfigurationPropertyName name, Bindable<T> targ
292
292
293
293
private Object bindBean (ConfigurationPropertyName name , Bindable <?> target ,
294
294
BindHandler handler , Context context ) {
295
- if (containsNoDescendantOf (context .streamSources (), name )
296
- || isUnbindableBean (name , target , context )) {
295
+ if (isUnbindableBean (name , target , context )) {
297
296
return null ;
298
297
}
299
298
BeanPropertyBinder propertyBinder = (propertyName , propertyTarget ) -> bind (
@@ -324,12 +323,6 @@ private boolean isUnbindableBean(ConfigurationPropertyName name, Bindable<?> tar
324
323
return packageName .startsWith ("java." );
325
324
}
326
325
327
- private boolean containsNoDescendantOf (Stream <ConfigurationPropertySource > sources ,
328
- ConfigurationPropertyName name ) {
329
- return sources .allMatch (
330
- (s ) -> s .containsDescendantOf (name ) == ConfigurationPropertyState .ABSENT );
331
- }
332
-
333
326
/**
334
327
* Create a new {@link Binder} instance from the specified environment.
335
328
* @param environment the environment source (must have attached
0 commit comments