在Liberty Server上运行spring-boot应用程序

问题描述 投票:1回答:2

我开发了一个独立的Spring Boot应用程序,它提供休息服务,我将其打包为jar,并且可以正常运行。为了在生产服务器(Websphere)上发布它,我必须将其转换为war

我更新了pom.xml,并添加了以下几行:

<properties>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.source>1.7</maven.compiler.source>
</properties>
<packaging>war</packaging>
<build>
    <finalName>${artifactId}</finalName>
</build>

然后,我启动了maven clean package,然后得到了war。因此,在Tomcat服务器上发布它可以正常工作,但是在Liberty上我得到了错误:

Error 404: SRVE0190E: File not found /

我还修改了我的入口点,如下所示:

@SpringBootApplication
@PropertySource("classpath:alerts.properties")
public class WebApplication extends SpringBootServletInitializer 
{

//  public static void main(String[] args) {
//      SpringApplication.run(WebApplication.class, args);
//  }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(WebApplication.class);
    }
}

没有成功,所以...如何在Liberty Server上进行春季启动大战?

谢谢

java spring-boot websphere-liberty
2个回答
1
投票

您无需为自由战争而运行Spring Boot jar。这是关于如何自由地部署Spring Boot jar的自由指南:https://openliberty.io/guides/spring-boot.html此处还有另一篇关于以自由方式运行Spring Boot应用程序的好文章:https://developer.ibm.com/articles/modernize-and-optimize-spring-boot-applications/


0
投票

您可以在https://github.com/anjumfatima90/dojo.samples中查看一个示例Spring Boot war应用程序。它具有自由部署的步骤。我希望这会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.