Converting to BigDecimal
of VRaptor is expecting a comma to decimal places because of your server's Locale (which is probably pt-BR
).
If you make your call like this: http://localhost:8080/app-teste/produto/1234/76,60
it should convert correctly, however I do not recommend leaving it like this.
What you can do is to get a String
and convert to BigDecimal
normally
@Get("/{produtoDto.codBarras}/{preco}")
public void produtoComPreco(ProdutoDto produtoDto, @PathParam("preco")
String preco) {
System.out.println(new BigDecimal(preco));
}
You can try to make Locale adjustment, but it must be set to pt-BR
, according to your server, and changing to another locale can influence your entire application.
Another solution would be to overwrite the BigDecimal converter, if you find it necessary.
Here is a link from a person who experienced this problem: link
And a link to a related issue: link