@RequestMapping( value = "/json/write/{id}.json", produces = {MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8"}) @ResponseBody @ResponseStatus(HttpStatus.OK) public Demo handleWriteJSON(@PathVariable("id") Long id, Model model) { logger.info("handleWriteJSON id==" + id); Demo demo = demoService.getById(id); return demo; }
@RequestMapping( value = "/xml/write/{id}.xml", produces = {MediaType.APPLICATION_XML_VALUE + ";charset=UTF-8"}) @ResponseBody @ResponseStatus(HttpStatus.OK) public Demo handleWriteXML(@PathVariable("id") Long id, Model model) { logger.info("handleWriteXML id==" + id); Demo demo = demoService.getById(id); // @DeclareParents DemoDeclareParentsService declareParents = (DemoDeclareParentsService) demoService; logger.info("@DeclareParents===" + declareParents.printString("@DeclareParents is ok")); return demo; }