Spring Boot application class

The following code block shows the generated SpringBootApplication class, FirstWebServiceWithKotlinApplication. We made the class open to enable Spring Boot to override it:

    @SpringBootApplication    open class FirstWebServiceWithKotlinApplication    fun main(args: Array<String>) {      SpringApplication      .run(         FirstWebServiceWithKotlinApplication::class.java,         *args)    }

The following are a few important things to note:

  • Package, import, and annotations are the same as that of a Java class.
  • The declaration of the main function in Java was public static void main(String[] args). In the preceding example, we are using the Kotlin function syntax. Kotlin does not have static methods. Any function declared outside of a class can ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.