Kotlin SpringBoot 파일 업로드/다운로드 - MultipartFile + Thymeleaf + Bootstrap 4 예제

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-springboot-upload-download-file-multipartfile-thymeleaf-bootstrap-4

Kotlin SpringBoot 파일 업로드/다운로드 - MultipartFile + Thymeleaf + Bootstrap 4 예제

튜토리얼에서는 Kotlin 언어를 사용하여 Thymeleaf 엔진 및 Bootstrap 4로 파일을 업로드/다운로드하는 SpringBoot 웹 애플리케이션을 빌드하는 방법을 보여줍니다.

기술


  • 자바 8
  • 메이븐 3.6.1
  • Spring Tool Suite: 버전 3.9.4.RELEASE
  • 스프링 부트: 2.0.2.RELEASE
  • 부트스트랩 4
  • Kotlin - 버전: 1.2.41

  • 목표



    아래와 같이 SpringBoot 프로젝트를 생성합니다.



    -> 양식 업로드:



    -> 양식 다운로드:



    관행



    아래 종속성을 사용하여 SpringBoot 프로젝트를 생성합니다.
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.module</groupId>
        <artifactId>jackson-module-kotlin</artifactId>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jdk8</artifactId>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-reflect</artifactId>
    </dependency>

    프런트엔드



    멀티파트 양식 업로드



    –/templates/multipartfile/uploadform.html 파일 생성:

    더 읽어보기:

    https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-springboot-upload-download-file-multipartfile-thymeleaf-bootstrap-4

    Kotlin SpringBoot 파일 업로드/다운로드 - MultipartFile + Thymeleaf + Bootstrap 4 예제

    좋은 웹페이지 즐겨찾기