spring boot返回json数据,在html页面通过ajax异步请求取不到数据

1.这是我的controller

 @RestController
public class ComputeController {

    private final Logger logger = Logger.getLogger(getClass());

         @RequestMapping(value = "/test", method = RequestMethod.GET)
    public List<String> test() {
        ServiceInstance instance = client.getLocalServiceInstance();

        List<String> list = new ArrayList<>();
        list.add("hello");
        list.add("world");
        logger.info("/test test" + instance.getHost() + ",service_id:" + instance.getServiceId() + ",result:" + list.toString());
        return list;
    }

2.这是我的html

 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>INDEX</title>
    <script src="jquery-1.8.0.min.js"></script>
    <script>
        $(document).ready(function () {
            $("#btn").click(function () {
                alert("start");
                $.get("http://localhost:4444/add?a=12&b=3", function (data) {
                    $("div").html(data);
                });
                alert("end");
            });
        });
    </script>
</head>
<body>
<h2>INDEX</h2>
<button id="btn">ajax</button>
<div id="div"></div>
</body>
</html>

问题:alert("start")和alert("end")都会执行,ajax的回调函数不能执行。

@RequestMapping后面添加@ResponseBody 不然的话返回的结果会把它当成界面返回 所以你获取不到json对象