tut*_*ity 8 java tomcat spring-boot
我有时会在pom.xml中看到以下声明......
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
....
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,spring-boot-starter-web被声明为tomcat-embed-jasper.
是不是spring-boot-starter-web已经有嵌入式tomcat?为什么有些开发人员仍然使用boot-starter-web声明tomcat-embed-jasper?或者有什么理由吗?
如你所说,spring-boot-starter-web
包括spring-boot-starter-tomcat
.你可以在这里查看
在spring-boot-starter-tomcat
包括tomcat-embed-core
.你可以在这里查看
但是,似乎tomcat-embed-core
不包括在内tomcat-embed-jasper
.事实上,是tomcat-embed-jasper
谁包括依赖tomcat-embed-core
.检查它在这里
无论如何,tomcat-embed-jasper
标记为provided
,所以表示您希望JDK或容器在运行时提供依赖关系.此范围仅在编译和测试类路径中可用,并且不可传递.
总之,spring-boot-starter-web
包括tomcat嵌入式依赖,但它不包括jasper嵌入式依赖,因此应该是单独声明它的原因.
另外,请记住,使用Spring IO Platform作为父级,您可以轻松地管理依赖项.要了解更多相关信息,您可以阅读我的帖子
希望能帮助到你,
归档时间: |
|
查看次数: |
16596 次 |
最近记录: |