Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default BindHandler in programmatically created Binder #17773

Closed
bsideup opened this issue Aug 2, 2019 · 1 comment
Closed

Default BindHandler in programmatically created Binder #17773

bsideup opened this issue Aug 2, 2019 · 1 comment
Labels
type: enhancement A general enhancement
Milestone

Comments

@bsideup
Copy link
Contributor

bsideup commented Aug 2, 2019

I am trying to use the Binder API programmatically ( context ).

The current usage looks more or less like this:

// Create a binder
var binder = Binder.get(environment);
// Some time later
var bindHandler = new ValidationBindHandler(
    new SpringValidatorAdapter(validator)
);
var bindable = Bindable.of(GRpcServerProperties.class);
var serverProperties = binder.bindOrCreate("grpc", bindable, bindHandler);

It would be helpful to be able to set the default BindHandler, so that the actual bind invocation is cleaner:

var bindHandler = new ValidationBindHandler(
    new SpringValidatorAdapter(validator)
);
// Create a binder that validates by default
var binder = Binder.get(environment, bindHandler);
// Some time later
var serverProperties = binder.bindOrCreate("grpc", GRpcServerProperties.class);
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 2, 2019
@mbhave mbhave added the for: team-attention An issue we'd like other members of the team to review label Aug 2, 2019
@philwebb
Copy link
Member

philwebb commented Aug 3, 2019

This seems sensible to me. I think we didn't really consider such niceties before because we didn't anticipate that many people would use the Binder directly.

@philwebb philwebb added type: enhancement A general enhancement and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels Aug 3, 2019
@philwebb philwebb modified the milestones: 2.1.x, 2.2.x Aug 3, 2019
@snicoll snicoll modified the milestones: 2.2.x, 2.2.0.M5 Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants