在Service中优雅的获取Request、Response、Session
直接在Controller中向Service层方法中传入Request等信息可以是可以,但是很不美观,耦合度也很高。所以可以使用如下方法在Service层中获取Request等信息。
RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
String str = (String)requestAttributes.getAttri