SpringBoot 返回xml格式

               

在java bean上打一个标签

@XmlRootElement(name = "person"

在请求方法上改一下

 @RequestMapping(value = "/getUserBaseInfo", produces = { "application/json;charset=UTF-8" }) @ResponseBody public UserBaseInfo getUserBaseInfo(HttpServletRequest request) {


改为:


@RequestMapping(value = "/getUserBaseInfo", produces = { "application/xml;charset=UTF-8" }) @ResponseBody public UserBaseInfo getUserBaseInfo(HttpServletRequest request) {






           

你可能感兴趣的:(SpringBoot 返回xml格式)