摘要:
package com.example.demo.cors; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotati... 阅读全文
摘要:
比较常用的方式就是使用注解来添加对 监听器,过滤器,servlet的支持。 1.首先在启动类上添加 @ServletComponentScan 开启 对监听器,过滤器,servlet的注解扫描。 分别创建过滤器,拦截器,servlet 访问servlet结果如下: my filter....MySe 阅读全文
摘要:
springboot常用的异常处理推荐: 一.创建一个异常控制器,并实现ErrorController接口: 当系统内发生错误后会跳转到error页面。 二.创建一个异常句柄ErrorExceperHandler 重载方法针对Exception和RuntimeException进行拦截,当系统发生异 阅读全文