摘要: 1.介绍 通过之前的文章来看,SpringBoot涵盖了很多配置,但是往往一些配置是采用原生的Servlet进行的,但是在SpringBoot中不需要配置web.xml的 因为有可能打包之后是一个jar包的形式,这种情况下如何解决?SpringBoot 提供了两种方案进行解决 2.快速开始 2.1 阅读全文
posted @ 2018-09-10 16:56 沫小淘 阅读(747) 评论(0) 推荐(0) 编辑
摘要: 1.在入口Application类上加入注解@ServletComponentScan 2.新建Servlet类,继承HttpServlet并且加入注解 @WebServlet(name="TestServlet",urlPatterns="/test") 3.之后运行代码,在地址栏输入 http: 阅读全文
posted @ 2018-09-10 15:45 沫小淘 阅读(2498) 评论(0) 推荐(0) 编辑
摘要: 在spring 3.2中,新增了@ControllerAdvice 注解,可以用于定义@ExceptionHandler、@InitBinder、@ModelAttribute,并应用到所有@RequestMapping中。参考:@ControllerAdvice 文档 一、介绍 创建 MyCont 阅读全文
posted @ 2018-09-10 10:44 沫小淘 阅读(1429) 评论(0) 推荐(0) 编辑