본문 바로가기
spring & spring boot

[스터디] 스프링 부트 개념과 활용 - 3주차 ( ~ 3/5)

by shakevan 2022. 3. 4.
SpringBoot 자체는 Server가 아니다!

//TODO SpringBoot 없이 Tomcat 띄우는거 실패함 이유 찾기

 

 

ServletWebServerFactoryAutoConfiguration

- 서블릿 웹 서버 생성을 자동으로 해주는 AutoConfiguration

DispatcherServlet

- Spring에서 서블릿들을 만들고 관리해주고 있음

https://docs.spring.io/spring-framework/docs/5.3.15/reference/html/web.html#mvc-servlet

 

Web on Servlet Stack

Spring Web MVC is the original web framework built on the Servlet API and has been included in the Spring Framework from the very beginning. The formal name, “Spring Web MVC,” comes from the name of its source module (spring-webmvc), but it is more com

docs.spring.io

 

Spring Boot는 기본적으로 Tomcat을 사용하게 됨

spring-boot-starter-web에는 spring-boot-starter-tomcat이 내장되어있다!

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.webserver.use-another

 

Spring Boot Reference Documentation

This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe

docs.spring.io

 

 

HTTPS 

로컬에서 인증서 만들고 Https로 띄우기

1) 인증서 만들기

 keytool -genkey -alias spring -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 4000

2) properties설정

server:
  ssl:
    key-store: keystore.p12
    key-store-type: PKCS12
    key-store-password: 123456
    key-alias: spring

 

※SSL을 적용하게되면 http로는 받을 수 없게 됨

- https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.webserver.configure-ssl

 

Spring Boot Reference Documentation

This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe

docs.spring.io

- 코드를 통해 추가해줄 수 있음

   - tomcat 예시 (2.2.x 브랜치에서는 spring-boot-samles 모듈이 삭제가됨!!!) : https://github.com/spring-projects/spring-boot/tree/2.1.x/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main

 

GitHub - spring-projects/spring-boot: Spring Boot

Spring Boot. Contribute to spring-projects/spring-boot development by creating an account on GitHub.

github.com

   - undertow : https://parkbongil.github.io/undertow-redirect/

   - jetty : TBD

 

HTTP2설정

각 서블릿 컨테이너마다 설정방법이 다름 : 

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.webserver.configure-http2

 

Spring Boot Reference Documentation

This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe

docs.spring.io

 

JAR

빌드방법

 

Maven

./mvnw clean package -DskipTests

Gradle

./gradlew clean build -x test

 

빌드결과물 위치

Maven : 각 모듈/target/~.jar

Gradle : 각 모듈/build/libs/~.jar

댓글