Spring Boot: SpringBootServletInitializer is verouderd

Ik probeer de Spring Boot-app in JBoss te implementeren door dit. Het werkte goed, maar SpringBootServletInitializeris verouderd in 1.4.0.RELEASE. Welke moet ik gebruiken?

Maven-afhankelijkheid

<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);
        }
    }

Antwoord 1, autoriteit 100%

Je gebruikt org.springframework.boot.context.web.SpringBootServletInitializerdit is verouderd. In plaats daarvan:

Gebruik

org.springframework.boot.web.support.SpringBootServletInitializer

Voor SpringBoot 2.0

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


Antwoord 2

Je kunt dit proberen – werkte voor mij

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

Other episodes