Class IgnoreErrorsBindHandler
- java.lang.Object
- org.springframework.boot.context.properties.bind.AbstractBindHandler
- org.springframework.boot.context.properties.bind.handler.IgnoreErrorsBindHandler
- All Implemented Interfaces:
BindHandler
public class IgnoreErrorsBindHandler extends AbstractBindHandler
BindHandler
that can be used to ignore binding errors.- Since:
- 2.0.0
Field Summary
Fields inherited from interface org.springframework.boot.context.properties.bind.BindHandler
DEFAULT
Constructor Summary
Constructors Constructor Description IgnoreErrorsBindHandler()
IgnoreErrorsBindHandler(BindHandler parent)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
onFailure(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Exception error)
Called when binding fails for any reason (including failures fromBindHandler.onSuccess(org.springframework.boot.context.properties.source.ConfigurationPropertyName, org.springframework.boot.context.properties.bind.Bindable<?>, org.springframework.boot.context.properties.bind.BindContext, java.lang.Object)
calls).Methods inherited from class org.springframework.boot.context.properties.bind.AbstractBindHandler
onFinish, onStart, onSuccess
Constructor Detail
IgnoreErrorsBindHandler
public IgnoreErrorsBindHandler()
IgnoreErrorsBindHandler
public IgnoreErrorsBindHandler(BindHandler parent)
Method Detail
onFailure
public Object onFailure(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Exception error) throws Exception
Description copied from interface:BindHandler
Called when binding fails for any reason (including failures fromBindHandler.onSuccess(org.springframework.boot.context.properties.source.ConfigurationPropertyName, org.springframework.boot.context.properties.bind.Bindable<?>, org.springframework.boot.context.properties.bind.BindContext, java.lang.Object)
calls). Implementations may choose to swallow exceptions and return an alternative result.- Specified by:
onFailure
in interfaceBindHandler
- Overrides:
onFailure
in classAbstractBindHandler
- Parameters:
name
- the name of the element being boundtarget
- the item being boundcontext
- the bind contexterror
- the cause of the error (if the exception stands it may be re-thrown)- Returns:
- the actual result that should be used (may be
null
). - Throws:
Exception
- if the binding isn't valid