Spring boot 1.5.2 未部署在 Openshift Tomcat 7(JBoss EWS 2.0) 中



我有一个 springboot 应用程序,我正在尝试在 Openshift Tomcat 7(JBoss EWS 2.0( 中部署它。重新启动服务器后,我收到以下控制台消息

INFO: Deploying web application archive /var/lib/openshift/-----xxxx-----/app-root/runtime/dependencies/jbossews/webapps/api.war
Jun 13, 2017 12:54:41 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/-----xxxx-----/app-root/runtime/dependencies/jbossews/webapps/api.war has finished in 67,610 ms

它说部署成功,但我在部署和所有 API 都给出 404 时没有得到经典的 spring 徽标(如下所示(。

  .   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _    
( ( )___ | '_ | '_| | '_ / _` |    
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |___, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.2.RELEASE) I am not getting this in console.

下面是我的 servlet 初始值设定项

public class ServletInitializer extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ApicApiNewApplication.class);
    }
}
为什么

会发生这种情况?

尝试在主 Spring-Boot 应用程序类中扩展SpringBootServletInitializer,如下所示:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(DemoApplication.class);
    }
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

最新更新