0

I am upgrading a project from 2.2.4 to 2.5.6. The binding that worked in 2.2.4 does not work for us in 2.5.6. So I am trying to get the spring binding working in 2.5.6 to see if that will solve our problem.

I have made 2 changes in the 2.5.6 project to try to get this working

Config.groovy:

grails.databinding.useSpringBinder=true

BuildConfig.groovy:

compile 'org.grails:grails-web-databinding-spring:2.5.6'

But after doing this the binding is not working for me. So I have tried with a very simple example, but this also is not working.

package simple

@grails.validation.Validateable
class SimpleCommand {

    String name
}

package simple

class SimpleController {

    def index(SimpleCommand simple) {
        render "Simply " + simple.name
    }
}

This works fine when I remove config for using the spring binder, but with it, simple.name is null.

Is there something else I should be doing?

Thanks,

Kenny

km2000
  • 305
  • 2
  • 10
  • There aren't many good reasons to use the spring binder if you are using Grails 2.5.6. A better approach would be to figure out why the default binder doesn't work for you. Can you describe what the default binder isn't doing that you want it to do? – Jeff Scott Brown Sep 21 '18 at 12:33
  • We have customer facing rest services (POST) that accept the following JSON - { "company.id" : "2", ... } . 2.2.4 binds this to the correct company while 2.5.6 does not. Changing the JSON to { "company" : { "id" : "2" }, ... } works fine in 2.5.6 but we were hoping not to impact the customers. – km2000 Sep 21 '18 at 15:36
  • This question https://stackoverflow.com/questions/19828274/grails-2-3-1-command-object-data-binding-at-controller-parameters could be relevant in your scenario – Mario Sep 22 '18 at 02:04
  • Thanks for the idea user615274, but had already seen that and tested it, but to no avail. – km2000 Sep 23 '18 at 19:54

0 Answers0