我正在尝试按照this将Spring Boot应用程序部署到JBoss。它运行良好,但在1.4.0.RELEASE中不推荐使用 SpringBootServletInitializer 。我应该使用哪一个?
Maven依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
Java代码
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.web.SpringBootServletInitializer;
@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
答案 0 :(得分:147)
您正在使用org.springframework.boot.context.web.SpringBootServletInitializer
这已被弃用。代替:
org.springframework.boot.web.support.SpringBootServletInitializer
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
答案 1 :(得分:0)
您可以尝试-为我工作
import org.springframework.boot.web.servlet.ServletContextInitializer;