This article is only about the deployment process, you have to ensure that your program can run in the IDE, first look at the port number set in your application.properties and your server tomcat port number is consistent
server.port=80
(I'm not sure if this configuration will affect deployment) look at the entry function for your application
@SpringBootApplication
@EnableAutoConfiguration(exclude = arrayOf(DataSourceAutoConfiguration::class))
class JnaApplication: SpringBootServletInitializer() {
override fun configure(application: SpringApplicationBuilder): SpringApplicationBuilder =
application.sources(JnaApplication::class.java)
}
fun main(args: Array<String>) {
runApplication<JnaApplication>(*args)
}
Springbootservletinitializer This class is responsible for having Tomcat launch your spring boot, and if it doesn't, you can only start your app manually and then configure your project structure I've chosen two forms of packaging, One is a war package (the war package is actually a compressed package, he can use the decompression tool to solve) a war package is the exploded form, the war package content in a folder in which the war package will contain all dependent libraries (Java project depends on the most of the library is a jar package)
In addition, I added the following in my gradle configuration file:
apply plugin: "war"
apply plugin: ‘application‘
mainClassName = ‘com.ysl.jna.JnaApplicationKt‘
(At the moment I don't know if it really works)
The packaged operation is done here after you can choose the form you want to pack (or both forms of the package) after the package is finished, you will find the package in your project subdirectory and upload the package you want to the Tomcat server.
How to deploy kotlin+spring boot-developed projects on Tomcat