Springboot

Spring boot AOP 사용시 request, response 객체 사용하기

25G 2023. 8. 17. 19:26

Spring boot Aop 사용시 request, response 객체 사용하기

// request
HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
// response
HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse();