Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- LIST
- git
- Analysis
- ai
- SSH
- javascript
- 자바
- data
- mysql
- 인공지능
- Github
- Deep
- db
- Security
- framework
- Numpy
- Server
- Spring
- Linux
- Pattern
- mariaDB
- error
- Web
- 함수
- learning
- interface
- Python
- DeepLearning
- java
- centos
Archives
- Today
- Total
PostIT
[Spring/AOP] HttpServletRequest,Response 변수 외 로직에 선언하기 본문
AOP를 처음으로 사용해보면서, 문제되는 사항 그리고 그에 대한 해결책을 찾아 올려보고자 한다.
1. AOP사용시 HttpServletRequest, HttpServletResponse 를 사용할 수 있는 방법.
- AOP에서는 HttpServletRequest를 이용하면 에러가 발생하게 된다. 한 1시간 넘게 고생한거 같다...
아래 사항으로 선언해서 사용하면 문제없이 AOP에서도 사용할 수 있다.
HttpServletRequest 만들기
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
HttpServletResponse 만들기
HttpServletResponse response = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getResponse();
'Spring' 카테고리의 다른 글
[Spring/Stomp] Spring stomp와 SockJs를 통한 웹소켓 구현하기, 그리고 장,단점 (1) | 2017.04.09 |
---|---|
[Java/Spring]JUnit을 이용한 단위 테스트 - 퍼옴 (0) | 2017.01.02 |
[Spring] MVC 패턴에서의 5가지 계층에 대한 정보 - 퍼옴 (0) | 2016.12.30 |
[Spring/Ajax]SpringMVC에서 Ajax와 JSON - 퍼옴 (0) | 2016.12.22 |
Comments