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
@ControllerAdvice throws java.lang.IllegalStateException: DataBinder is already initialized - call setAutoGrowNestedPaths before other configuration methods [SPR-9818] #14451
Comments
Marcel Overdijk commented Note that I'm not using
Although this does the job it's not the most beautiful solution imo.
in WebMvcConfigurationSupport. This would be in line with other confgureX methods in WebMvcConfigurationSupport. I'm reopening #13624 to start discussion again. |
Rossen Stoyanchev commented I've created a sample projectthat sets the autoGrowthNestedPath property from an |
Rossen Stoyanchev commented Resolving until further information is provided. |
David Melia commented Hi, I have just started using the new https://github.com/mzz6wh/spring-framework-issues/tree/master/SPR-9818 Seems to be a combination of using Any ideas? Thanks |
Rossen Stoyanchev commented Thanks for the repro project, will have a look. |
Sébastien Deleuze commented Hi, I have tested your repo project, thanks for providing it. Since the same WebDataBinder instance is injected in both In order to avoid the IllegalStateException, you need to call setAutoGrowNestedPaths() before registerCustomEditor(), for example by moving setAutoGrowNestedPaths() call in the Is this proposed approach fine for you ? |
David Melia commented Hi Sebastien, So I want to use Obviously it's up to you whether this is working as spec but just doesn't seem correct as my use case now means I cannot use a global init binder via Thanks |
Rossen Stoyanchev commented The order of invocation is quite clear with |
David Melia commented OK no problem. I didn't realise that Spring 4.0 allowed for a subset of controllers which will actually solve my issue. Thanks |
Marcel Overdijk opened SPR-9818 and commented
I'm trying to change the 'AutoGrowNestedPaths' globally using a
@ControllerAdvice
as:but I get this exception:
Note that when I move this
@InitBinder
to a controller I get the same exception.I'm using a Java config setup using WebMvcConfigurerAdapter with only basic configurations.
On a related note I wonder if there is a better way to set the 'AutoGrowNestedPaths' globally, e.g. in my WebConfig.java WebMvcConfigurerAdapter?
Affects: 3.2 M2, 4.0 RC2
Referenced from: commits spring-attic/spring-framework-issues@7b8508d
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: