
io.github.hengyunabc.bind.SpringBoot2Binder Maven / Gradle / Ivy
The newest version!
package io.github.hengyunabc.bind;
import org.springframework.boot.context.properties.bind.BindResult;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.core.env.ConfigurableEnvironment;
public class SpringBoot2Binder extends AbstractBinder {
@Override
public T bind(ConfigurableEnvironment environment, String prefix, Class type) {
Binder binder = Binder.get(environment);
Bindable bindable = Bindable.of(type);
BindResult bindResult = binder.bind(prefix, bindable);
return bindResult.get();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy