RestTemplate 대용량 파일 전송 시 OOM(Out Of Memory) 이 발생하여 검색 중 아래 방법처럼 설정 해준 후 오류를 해결 할 수 있었다.
[해결방법]
RestTemplate가 내부적으로 버퍼를 사용하게 되는데 requestFactory.setBufferRequestBody(false);를 사용하여 옵션을 꺼주면 된다.
RestTemplate restTemplate = new RestTemplate();
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setBufferRequestBody(false);
[오류 참고 사이트]
https://stackoverflow.com/questions/15781885/how-to-forward-large-files-with-resttemplate
How to forward large files with RestTemplate?
I have a web service call through which zip files can be uploaded. The files are then forwarded to another service for storage, unzipping, etc. For now the file is stored on the file system, then a
stackoverflow.com
'프로그래밍&IT > spring&spring boot' 카테고리의 다른 글
[Spirng 스프링] 웹사이트 파비콘 적용하기 (0) | 2021.06.26 |
---|---|
[spring boot 스프링부트] IntelliJ Gradle로 프로젝트 생성 후 mariaDB + Mybatis 연동하기 (0) | 2021.06.03 |
[Spirng 스프링] BeanUtils.copyProperties (0) | 2021.05.28 |