As Spring Framework 6 uses JDK17 for its baseline, we can make use of the methods transferTo(OutputStream out) and readAllBytes() supported by InputStream in JDK9 instead of StreamUtils.