通过WebSphere部署Kotlin Spring Boot应用程序

时间:2018-12-06 14:08:16

标签: java spring-boot kotlin websphere

我已经使用IntelliJ Idea在Kotlin编写了Spring Boot微服务,该服务在本地运行良好。我需要通过WebShpere部署它,但是在那里启动WAR时遇到问题。

微服务的主要类别如下

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class MyApplication

fun main(args: Array<String>) {
    runApplication<MyApplication>(*args)
}

使用mvn clean install创建WAR之后,如果仅通过此类通过WebSphere部署WAR,则SystemOut.log文件表明该服务根本无法启动。没有记录为"Started MyApplication in... <seconds>"

的日志条目

另一位开发人员将以下类添加到同一软件包中:

import org.springframework.boot.builder.SpringApplicationBuilder
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer

class ServletInitializer : SpringBootServletInitializer() {

    override fun configure(application: SpringApplicationBuilder) : SpringApplicationBuilder {
        return application.sources(MyApplication::class.java)
    }

}

如果我使用Maven进行重建并通过WebShpere重新部署,SystemOut.log文件将显示该服务开始启动,但是该日志仅读取"Started ServletInitializer in... <seconds>"而不是运行MyApplication类

我不明白为什么WebSphere似乎没有启动或识别主类。感谢您的协助。

0 个答案:

没有答案