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 ...