I have made a crud ajax rest application using spring framework. The problem is: When i am sending post from client to server, i am getting object filled with nulls, from client side i have status 200. Here is my code:
Product class
public class Product {//getters,setters and toString() generated with Eclipse
private Integer id;
private String name;
private String description;
private String createdDate;
private Integer placeStorage;
private Boolean reserved;
Rest controller
@RestController
public class ProductRestController {
@Autowired
private ProductServiceImpl productService;
@PostMapping(value = "/getRecord")
public void addProduct(Product product) {
System.out.println(product);
}
}
AJAX function
function sendRecord(data){
$.ajax({
type : 'POST',
url : '/getRecord',
contentType : "application/json",
cache : false,
dataType: 'json',
processData:false,
data: data,
dataType:'json',
success : function(data) {
update_table();
}
});
}
Data that i am posting
Data that i am getting