mardi 12 septembre 2017

Spring controller excluding Boolean variables from response

I have a web application. The front-end is in ember.js and the back-end is in Java, Spring MVC. I am facing a very weird problem.

I make an ajax request to my back-end and fetch some data. I return a custom object.

When I fetch data from the back-end on my local machine, all is fine but on a local server the custom object excludes Boolean fields. (Rest fields like String are received fine).

In the class of my custom object, I have set the @JsonProperty annotations on the getters and setters of these Boolean variables.

In my javascript file, I am sending some params in an ajax request via GET with contentType: "application/json"

These are the annotations in my controller:

    @ResponseBody
    @RequestMapping(value = "/getData", method = RequestMethod.GET,
                    produces = MediaType.APPLICATION_JSON_VALUE)

I am 100% sure that the code is the same both on server and my local environment, and the data has those boolean variables before sending out the custom object.

I can't figure out what might be wrong here, am I missing some configuration? Or is there something else?




Aucun commentaire:

Enregistrer un commentaire