Java Spring Boot:SpringBootServletInitializer不推荐使用

Java Spring Boot:SpringBootServletInitializer不推荐使用,java,spring-boot,Java,Spring Boot,我正试图通过以下方式将SpringBoot应用程序部署到JBoss。它工作得很好,但SpringBootServletializer在1.4.0.0版本中被弃用。我应该用哪一个 Maven依赖性 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <v

我正试图通过以下方式将SpringBoot应用程序部署到JBoss。它工作得很好,但SpringBootServletializer在1.4.0.0版本中被弃用。我应该用哪一个

Maven依赖性

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.0.RELEASE</version>
</parent>

您使用的是
org.springframework.boot.context.web.SpringBootServletInitializer
这是不推荐使用的。相反:

使用
org.springframework.boot.web.support.SpringBootServletInitializer

对于SpringBoot 2.0
org.springframework.boot.web.servlet.support.SpringBootServletInitializer

你可以试试这个-对我有用

import org.springframework.boot.web.servlet.ServletContextInitializer;

请您澄清一下您的问题,我看到您在代码中显示您使用了@springBootApplication而不是SpringBootServletilizer。这两个有什么关系?是的,你是对的。我的问题不充分。我已经更新了我的问题。对于SpringBoot2.0.0,您需要使用“org.springframework.boot.web.servlet.support.SpringBootServletInitializer”,为什么它现在在支持包中?在新版本中是否有其他方法创建servlet?
import org.springframework.boot.web.servlet.ServletContextInitializer;