How to deploy kotlin+spring boot-developed projects on Tomcat

Source: Internet
Author: User
Tags tomcat server

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.