SpringBoot返回json格式到浏览器上,出现乱码问题

在对应的Controller上的requestMapping中添加:

@RestController
@EnableAutoConfiguration
@RequestMapping(value = "/", produces = "application/json; charset=utf-8")
public class hello {
 @RequestMapping("/")
 public String home() {
   return "Hisdfds士大夫";
 }

 public static void main(String[] args) {
   SpringApplication.run(hello.class, args);
 }
}

转载于:https://www.cnblogs.com/zhangwufei/p/6803453.html

你可能感兴趣的:(SpringBoot返回json格式到浏览器上,出现乱码问题)