Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot: SpringBootServletInitializer is deprecated

I am trying to deploy Spring Boot app to JBoss by following this. It worked well but SpringBootServletInitializer is deprecated in 1.4.0.RELEASE. Which one should I use?

Maven depedency

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

Java Code

 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);         }     } 
like image 640
Aung Myat Hein Avatar asked Aug 09 '16 05:08

Aung Myat Hein


2 Answers

You are using org.springframework.boot.context.web.SpringBootServletInitializer this is deprecated. Instead:

Use

org.springframework.boot.web.support.SpringBootServletInitializer

For SpringBoot 2.0

org.springframework.boot.web.servlet.support.SpringBootServletInitializer

like image 60
A0__oN Avatar answered Sep 21 '22 17:09

A0__oN


You can try this - worked for me

import org.springframework.boot.web.servlet.ServletContextInitializer; 
like image 28
pradeep Avatar answered Sep 21 '22 17:09

pradeep