English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
spring-boot-starter-web은 두 가지 중요한 기능을 가지고 있습니다:
Web 개발과 호환 자동 구성
Web 애플리케이션을 개발하려면 pom.xml 파일에 다음 의존성을 추가해야 합니다:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.2.2.RELEASE</version> </dependency>
Spring web 랜더는 Spring MVC, REST, Tomcat을 기본으로 사용하는 내장 서버로 시작됩니다. 단일 spring-boot-starter-web 의존성은 전달 가능하게 얻어와서 Web 개발과 관련된 모든 의존성을 가져옵니다. 또한, 빌드 의존성 개수를 줄입니다. spring-boot-starter-web은 다음 내용에 따라 전달 가능하게 됩니다:
org.springframework.boot: spring-boot-starter org.springframework.boot: spring-boot-starter-tomcat org.springframework.boot: spring-boot-starter-validation com.fasterxml.jackson.core: jackson-databind org.springframework: spring-웹 org.springframework: spring-webmvc
기본적으로, spring-boot-starter-web은 다음 tomcat 서버 의존성을 포함하고 있습니다:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <version>2.0.0.RELEASE</version> <scope>compile</scope> </dependency>
spring-boot-starter-web은 Web 개발에 필요한 다음을 자동으로 구성합니다:
스케줄러 Servlet 에러 페이지 은 정적 의존성을 관리하는 Web JAR입니다 내장 Servlet 컨테이너
모든 Spring Boot应用程序은 내장 서버를 포함하고 있습니다. 내장 서버는 배포 가능한 애플리케이션의 일부로 내장됩니다. 내장 서버의 장점은 우리가 환경에서 서버를 사전 설치할 필요가 없다는 것입니다. Spring Boot를 사용하면 기본 내장 서버가 Tomcat Spring Boot는 또 다른 두 가지 내장 서버를 지원합니다:
Jetty 서버 를 포함
입니다. 다른 내장 웹 서버를 사용하여reactor spring-boot-starter-웹 servlet 스택을 포함 spring-boot-starter-tomcat 를 통해 포함 Tomcat 를 포함 spring-boot-starter-jetty 을 사용할 수 있지만, 우리는 다음을 통해 Tomcat을 사용할 수 있습니다 spring -boot-starter-또는 undertow
입니다. 에 대한reactor spring-boot-starter-application, webflux webflux spring-boot-starter-를 포함하고 있습니다-reactor netty 을 사용할 수 있지만, 우리는 다음을 통해 Reactor Netty를 구현할 수 있습니다 spring-boot-starter-tomcat, spring-boot-starter-jetty
Spring Boot는 또 다른 이름으로 Jetty 서버입니다. 이는 HTTP 서버와 Servlet 컨테이너로, 정적 및 동적 내용을 제공하는 기능을 가지고 있습니다.
Application에서 Jetty 서버를 추가하려면 추가해야 합니다 spring-boot-starter-jetty 의존성
기억하세요: 입니다.应用程序에서 Jetty 서버를 사용할 때는 다음을 확인하십시오 기본적인 Tomcat 서버를 제외합니다 spring-boot-starter-웹 입니다. 서버 간의 충돌을 피합니다.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency>
우리는 다음과 같이 사용할 수 있습니다 application.properties 파일은 커스터마이즈된 Jetty 서버의 행동을 정의합니다.
Spring Boot는 또 다른 이름으로 Undertow 서버입니다. 이는 Jetty와 같은 내장 웹 서버와도 같습니다. 이는 Java로 작성되고 JBoss가 관리하고 후원합니다. 엔더토프 서버의 주요 장점은 다음과 같습니다:
HTTP를 지원하는/2 HTTP 업그레이드 지원 Websocket 지원 Servlet에 대한 지원을 제공합니다 4.0의 지원 유연 내장 가능
기억하세요: :应用程序에서 엔더토프 서버를 사용할 때는 다음을 확인하십시오 spring-boot-starter에기본적인 Tomcat 서버를 제외합니다 -웹서버 간의 충돌을 피합니다.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-undertow</artifactId> </dependency>
우리는 다음과 같이 사용할 수 있습니다 application.properties 파일은 커스터마이즈된 엔더토프 서버의 행동을 정의합니다.
spring-boot-starter-웹은 스프링 웹 의존성을 포함하고 있으며, 이는 스프링-boot-starter-tomcat。 spring-boot-starter-web은 다음과 같은 내용을 포함하고 있습니다:
spring-boot-starter jackson spring-core spring-mvc spring-boot-starter-tomcat
spring-boot-starter-tomcat Tomcat 서버와 관련된 모든 내용을 포함하고 있습니다.
core el logging websocket
starter-tomcat은 다음과 같은 의존성을 가집니다:
<dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>8.5.23</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-el</artifactId> <version>8.5.23</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-websocket</artifactId> <version>8.5.23</version> <scope>compile</scope> </dependency>
또한 다음과 같이 사용할 수 있습니다. spring-mvc 내장된 Tomcat 서버를 사용하지 않고 싶다면, 다음과 같이 사용해야 합니다.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency>