摘要:
正常情况下,spring 中的拦截器是不能直接 使用 @Autowired注入对象 , 如果需要在拦截器中注入service 或者配置,需要将这个拦截器交给spring管理,并且在注册拦截器时使用spring管理的bean,这才会让@Autowired注解生效。 如下操作: (要注意我使用的注解) 阅读全文
posted @ 2022-01-13 13:47
得好好活
阅读(219)
评论(0)
推荐(0)
摘要:
1、 写一个filter 类 import javax.servlet.*; import java.io.IOException; import org.springframework.beans.factory.annotation.Autowired; @Component // 将Filte 阅读全文
posted @ 2022-01-13 13:36
得好好活
阅读(1812)
评论(0)
推荐(0)
摘要:
解决跨域 方法1:写一个类处理跨域问题 import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry 阅读全文
posted @ 2022-01-13 13:18
得好好活
阅读(77)
评论(0)
推荐(0)
摘要:
写一个配置类拦截所有Exception import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; 阅读全文
posted @ 2022-01-13 13:13
得好好活
阅读(928)
评论(0)
推荐(0)
摘要:
传入所有节点,返回树 实体类 public class ProvinceCityInfo implements Serializable { private Integer id; /** * 名字 */ private String name; /** * 父id */ private Integ 阅读全文
posted @ 2022-01-13 00:11
得好好活
阅读(48)
评论(0)
推荐(0)

浙公网安备 33010602011771号