我尝试过注入HttpRequest,HttpResponse。
尝试
@Bean
public RequestContextListener requestContextListener(){
return new RequestContextListener();
}
@Controller("/test")
public class Test {
public String callback() {
SecurityContextHolder.getContext().setAuthentication(auth);
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
HttpServletRequest request = attributes.getRequest();
HttpServletResponse response = attributes.getResponse();
}
}
没什么,我总是收到一个空物。
答案 0 :(得分:0)
这是Spring的方法:
select X, count(distinct Y)
from TBL
group by X