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

Cannot customize autoGrowCollectionLimit on @InitBinder method when set custom MessageCodesResolver to Spring MVC [SPR-15009] #19576

Closed
spring-projects-issues opened this issue Dec 13, 2016 · 5 comments
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Dec 13, 2016

Kazuki Shimizu opened SPR-15009 and commented

In current implementation, We cannot customize the autoGrowCollectionLimit of DataBinder when set a custom MessageCodesResolver to the Spring MVC using WebMvcConfigurerAdapter or <mvc:annotation-driven>.

Because it initialize a BindingResult on the DataBinder as follow:

public void setMessageCodesResolver(MessageCodesResolver messageCodesResolver) {
    getInternalBindingResult().setMessageCodesResolver(messageCodesResolver);
}

I think it should be changed to same logic with ConversionService as follow:

public void setMessageCodesResolver(MessageCodesResolver messageCodesResolver) {
    Assert.state(this.messageCodesResolver == null, "DataBinder is already initialized with MessageCodesResolver");
    this.messageCodesResolver = messageCodesResolver;
    if (this.bindingResult != null && messageCodesResolver != null) {
        this.bindingResult.setMessageCodesResolver(messageCodesResolver);
    }
}

What do you think ?
I will submit a PR at the later.


Affects: 4.3.4

Issue Links:

  • #19454 Detect invalid configuration for autoGrowCollectionLimit on DataBinder

Referenced from: pull request #1266, and commits 307e37a, 8d55c7d, 58eccfe, 361ab6b, 9f22928

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 13, 2016

Kazuki Shimizu commented

I've submitted the PR for fix this.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 13, 2016

Juergen Hoeller commented

Good point. Thanks for the pull request!

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 13, 2016

Kazuki Shimizu commented

thanks for merging !!

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 20, 2016

Kazuki Shimizu commented

Hi Juergen Hoeller, I think better to apply changes of test class to the 4.3.x line too.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 21, 2016

Juergen Hoeller commented

Good catch, backporting the tests as well now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.