@Autowired
private HttpServletRequest request;
为什么会报错,springboot
@Autowired
private HttpServletRequest request;
为什么会报错,springboot
可以用
ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
获取request