I use SpringMVC 4.2.5, and make a rest Controller, but the response is not what I want.
Here it's the detail.
I have an Entity named propertyEntity
,
public class PropertyEntity implements Serializable, Cloneable {
private static final long serialVersionUID = -7032855749875735832L;
private int id;
private String propertyName;
private boolean isEnable;
private boolean isDimension;
private boolean isMetric;
}
and the Controller is:
@Controller
@RequestMapping("/api/v1/properties")
public class PropertyController {
@RequestMapping(method = RequestMethod.GET,
produces = "application/json;charset=utf-8")
@ResponseStatus(HttpStatus.OK)
public @ResponseBody
List<PropertyEntity> getAll() {
return propertyService.getAll();
}
}
When I request the api, the result is:
[
{
"id": 1,
"propertyName": "money1",
"isEnable": true,
"dimension": false,
"metric": true
},
{
"id": 2,
"propertyName": "money2",
"isEnable": true,
"dimension": false,
"metric": true
}
]
what I want is:
[
{
"id": 1,
"propertyName": "money1",
"isEnable": true,
"isDimension": false,
"isMetric": true
},
{
"id": 2,
"propertyName": "money2",
"isEnable": true,
"isDimension": false,
"isMetric": true
}
]
The unexpected thing is:
isDimention
is changed to dimension
,
isMetric
is changed to metric
,
but isEnable
is right.