springboot+bootstrap项目Uncaught SyntaxError: Unexpected token

springboot+bootstrap中js引入错误:Uncaught SyntaxError: Unexpected token <
如下图
springboot+bootstrap项目Uncaught SyntaxError: Unexpected token_第1张图片
查错过程:

  • 先去看了js引入,发现并没有错误

  • 然后查询了一下js路径

springboot+bootstrap项目Uncaught SyntaxError: Unexpected token_第2张图片
发现页面依旧是我写的一个publish页面,然后若有所思,发现了原因所在。。

问题原因:
PublishController 中的 @GetMapping忘记加具体映射路径

@Controller
public class PublishController {
    @GetMapping
    public String publish(){
        return "publish";
    }
}

现在加上映射路径:

@Controller
public class PublishController {
    @GetMapping("/publish")
    public String publish(){
        return "publish";
    }
}

再次搜索js的路径,如下图:
springboot+bootstrap项目Uncaught SyntaxError: Unexpected token_第3张图片
问题解决啦!!!!
springboot+bootstrap项目Uncaught SyntaxError: Unexpected token_第4张图片

你可能感兴趣的:(bug修改,springboot,js引入,bootstrap)