How to change embedded tomcat's version in existing spring boot app?

别说谁变了你拦得住时间么 提交于 2020-01-14 10:35:33

问题


I'm currently running spring-boot version 1.4.0.RELEASE application with embedded tomcat. Included Tomcat's version is 8.5.4

There's a need to update the tomcat version to 9.x. When I looked at mvnrepository here, I found that there's an update available to tomcat version 9.0.5 (shown in pic below)

How should I use this version in my project if there's no way to directly mention this version in my pom.xml?

I do not want to go the traditional deployment route (WAR artifacts on external tomcats).


回答1:


If you are using spring boot gradle plugin and spring boot starters ..you can customise the version by setting maven project properties in build.gradle.

ext['tomcat.version'] = '8.5.34'

You can find all the external dependencies that can be customised in spring-boot-dependencies




回答2:


Late to the party I know, was looking for a similar issue, thought I'd share a more literal hint.

You need to override the properties set in spring's parent pom to suit your case (and compatibility too):

<properties>
......
    <tomcat.version>9.0.5</tomcat.version>
......
<properties>

This is according to Introduction to Spring. Their example shows many other dependencies cherry-picked.



来源:https://stackoverflow.com/questions/49192295/how-to-change-embedded-tomcats-version-in-existing-spring-boot-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!