I was build my api based on springmvc v4.3.12, weblogic12c, there is one api will return a big number, its a BigDecimal field, maybe its because the number is too big that make this strange things happend.
code:
@GetMapping(value = "test")
public ResponseEntity<Map<String, BigDecimal>> test() throws IOException {
Map<String, BigDecimal> map = Maps.newHashMap();
map.put("a", new BigDecimal("555511112222333.1729").setScale(4, BigDecimal.ROUND_DOWN));
return ResponseEntity.ok(map);
}
output:
{
"a": 555511112222333.2
}
if change the number to 5555111122223.1729, the output will be 5555111122223.173
if change the number to 555511.1729, the output will be 555511.1729
I have debugged the code of spring, it was wrote the number into servlet response buffer correctly, but in the caller side, like swagger ui, the number was lost precisions.
I also tried with springboot v2.3.2, the api returned Bigdecimal field correctly, did't lost precisions.