I am having a scope Object in Angular Controller.
When I try to pass it onto Spring Rest Controller , the control is passed to Spring rest controller. But when I try to print the value its getting printed as null.
Scenario:
AngularController :
file.upload = Upload.upload({
url : '/uploadTemplate',
data : {
multipartFile : file,
am : appMaster
}
});
RestController.java
@RequestMapping(value = "/uploadTemplate", produces = "application/json")
@ResponseBody
public StringResponse uploadFiles(MultipartFile multipartFile,ApplicationMaster am) {
System.out.println("Inside");
System.out.println(am.getAbbreviation());
System.out.println(am.getAppId());
System.out.println(am.getName());
}
The first System.out.println Inside is getting printed in console , but next the values of am object are printed as null.
If I alert the values in AngularController , the desired values are alerted.
@RequestBodyon theApplicationMasterobject to unmarshall the request body.ApplicationMaster. I strongly suggest a read of the spring reference guide and how (un)marshaling JSON works.