日常笔记


RestController和 controller 的区别:

用Controller配合视图解析器才能返回到指定页面。在对应的方法上加上ResponseBody注解才能返回JSON,XML或自定义mediaType的内容到页面。
RestController集合了controller和ResponseBody,既可以做控制器 又可以返回视图。

 

@RunWith作用

@RunWith就是一个运行器

@RunWith(JUnit4.class)就是指用JUnit4来运行

@RunWith(SpringRunner.class),使用spring运行

SpringRunner 对 junit 的版本有要求,需要 4.12 及以上。

参考文档:https://www.cnblogs.com/qingmuchuanqi48/p/11886618.html

posted on 2022-06-16 11:42  周公  阅读(2)  评论(0编辑  收藏  举报

导航