标签: java spring servlets
答案 0 :(得分:121)
答案 1 :(得分:96)
答案 2 :(得分:2)
根据建议的here,您还可以将HttpServletRequest作为方法参数注入,例如:
HttpServletRequest
public MyResponseObject myApiMethod(HttpServletRequest request, ...) { ... }