简体   繁体   中英

Tomcat and spring-boot-starter

I have some Spring Boot 2.1 applications and they are all hosted on Tomcat 8.5 We normally use the following POM.xml structure:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

The issue we are facing is about the size, we realized that spring-boot-started takes a lot of MB, while we have another application which is using only: spring-boot-starter-web and spring-boot-starter-tomcat and the size jump down from 50MB to 10MB.

Assuming we only use Tomcat, except for development where we use mvn spring-boot run , what happens if I remove spring-boot-starter ? Can I have an application with only spring-boot-starter-web and spring-boot-starter-tomcat but still being able to use mvn spring-boot run during development?

See this answer by ltalhouarne .

spring-boot-starter-web contains spring web dependencies (including spring-boot-starter-tomcat ):

spring-boot-starter
jackson
spring-core
spring-mvc
spring-boot-starter-tomcat

Simply including spring-boot-starter-web should be enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM