今天用springboot新建了一个项目,是用IDEA的spring Initializr生成的,在本地用内嵌的tomcat启动项目能够正常启动,但是当我用外面的tomcat服务器时,我发现springboot并没有被启动,没有加载application而是只是显示Artifact is deployed successfully。

那怎么解决呢?IDEA默认生成的那个项目的Application没有继承SpringBootServletInitializer,如果我们想要在外部的tomcat中启动项目,就需要继承它。

这样就可以进行发布了。
我在一些博客里看到说这个时候要让本地能用内嵌的tomcat进行启动,pom里需要配置:


但是我发现这样配置,当我用运行Application main进行启动时,

当我取消tomcat provided的限制时就可以正常启动了,所以对于内嵌tomcat provided 和 SpringBootServletInitializer还有些迷惑。
网友评论