2016-08-09 22 views
39

Próbuję wdrożyć aplikację Spring Boot do JBoss, postępując zgodnie z this. To zadziałało dobrze, ale SpringBootServletInitializer jest przestarzałe w wersji 1.4.0.RELEASE. Którego powinienem użyć?Spring Boot: SpringBootServletInitializer jest przestarzałe

Maven depedency

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

kod 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

Czy możesz wyjaśnić swoje pytanie, widzę, że w twoim kodzie pokazałeś, że użyłeś @ springBootApplication zamiast SpringBootServletInitializer. Jak są 2 powiązane? – user641887

+0

Tak, masz rację. Moje pytanie jest niewystarczające. Zaktualizowałem moje pytanie. –

Odpowiedz

102

Używasz org.springframework.boot.context.web.SpringBootServletInitializer ta jest zastąpiona

STOSOWANIA

org.springframework.boot.web.support.SpringBootServletInitializer

+0

Dzięki Aman. Zaimportowałem niedbale. –

+3

Dla wiosennego rozruchu 2.0.0 należy użyć "org.springframework.boot.web.servlet.support.SpringBootServletInitializer" – BigJ