摘要: public class MyInterceptor1 implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse respons 阅读全文
posted @ 2022-07-08 04:35 小白冲冲 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 4.4 节向读者介绍了Spring Boot 中的全周异常处理。在处理异常时, 开发者可以根据实际情况返回不同的页面,但是这种异常处理方式一般用来处理应用级别的异常,有一些容器级别的错误就处理不了,例如Filter 中抛出异常,使用@ControllerAdvice 定义的全局异常处理机制就无法处理 阅读全文
posted @ 2022-07-08 03:35 小白冲冲 阅读(8) 评论(0) 推荐(0) 编辑
摘要: @ControllerAdvice 就是@Controller 的增强版。@ControllerAdvice 主要用来处理全局数据, 一般搭配 @ExceptionHandler、@ModelAttribute 以及@InitBinder 使用。 @ControllerAdvice 最常见的使用场景 阅读全文
posted @ 2022-07-07 05:49 小白冲冲 阅读(44) 评论(0) 推荐(0) 编辑
摘要: @RestController public class FileUploadController ( SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/"); @PostMapping("/upload") public String 阅读全文
posted @ 2022-07-06 04:44 小白冲冲 阅读(502) 评论(0) 推荐(0) 编辑
摘要: Spring Boot 中对于SpringMVC 的自动化配置都在WebMvcAuto Configuration 类中,在WebMvcAutoConfiguration 类中有一个静态内部类WebM vcAutoConfigurationAdapter , 实现 了WebMvcConfigurer 阅读全文
posted @ 2022-07-06 03:28 小白冲冲 阅读(90) 评论(0) 推荐(0) 编辑
摘要: Spring MVC 中使用消息转换器HttpMessageConverter 对JSON 的转换提供了很好的支持。 在Spring Boot 中只要有Web 依赖,这个依赖中默认加入了jackson-databind 作为JSON 处理器,此时不需要添加额外的JSON 处理器就能返回一段JSON 阅读全文
posted @ 2022-07-04 05:30 小白冲冲 阅读(176) 评论(0) 推荐(0) 编辑
摘要: @Controller public class BookController { @GetMapping ("/book") @ResponseBody public Book book() { Book book= new Book(); book.setAuthor("罗贯中"); book. 阅读全文
posted @ 2022-07-04 04:50 小白冲冲 阅读(56) 评论(0) 推荐(0) 编辑
摘要: TextField( decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(30))), prefixIcon: Icon(Icons.searc 阅读全文
posted @ 2022-04-25 01:02 小白冲冲 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 进入网站 https://start.spring.io/ 添加依赖 点击GENERATE生成 下载maven https://maven.apache.org/download.cgi 选择这个 解压到电脑并给文件夹改名为maven(只是让名字短点) 新建系统变量 修改path变量 新建 %MAV 阅读全文
posted @ 2022-02-28 02:46 小白冲冲 阅读(844) 评论(0) 推荐(0) 编辑
摘要: 想要去除右上角的DEBUG标签只需要在MaterialApp中加入debugShowCheckedModeBanner: false即可 class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); 阅读全文
posted @ 2022-02-21 03:38 小白冲冲 阅读(280) 评论(0) 推荐(0) 编辑