스프링(Spring) Byte[] 통해서 MariaDB BLOB 이미지 Insert 하기

https://infondgndg91.blogspot.com/2018/07/input-typefile-multiple.html 에서 <input type="file multiple />태그를 이용해서 이미지를 브라우저 화면에서 업로드하고 뿌려주는 작업을 해보았다. 지금부터 얘기할 작업은 MultipartHttpServletRequest를 통해서 이미지파일들을 Controller에서 byte 배열로 처리해주고 MariaDB의 BLOB 타입의 컬럼에 인서트 하는 일이다. 먼저 pom.xml에 file업로드 관련 디펜던시를 추가해준다. 버전은 호환성에 맞게 알아서 맞춰주어야 할 것 같다. <!-- file업로드 --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> 본인의 환경설정 경로는 아래와 같이 web.xml에 되어있다. <!-- 스프링의 환경설정 파일 로딩 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/root-context.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> root-context.xml파일에 아래와 같이 ...