Points to Note When Implementing Spring Boot with Kotlin

Nothing article related to Kotlin’s Spring Boot at all
I recently implemented the Spring Boot application with Kotlin, but I have spent quite a bit of time doing something a little about articles and cases implementing Spring Boot on Kotlin on the net.
So, I will introduce what I am addicted in that, so please refer to it.
@RequestMapping
It is an annotation mapping request and Controller, written in Java, it becomes as follows.
@RequestMapping(path = “/content”, method = RequestMethod.GET)When writing with Kotlin, you must write it as an array using arrayOf.
@RequestMapping(path = “/content”, method = arrayOf(RequestMethod.GET)).class
It becomes the following in Java.
Integer.classString.class
It is below in kotlin. In the case of Kotlin, if you write property name, you will getter by using Java when compiling to Java I think that it is ::.
Int::classString::class
@SqlResultSetMapping
In the case of Java annotation can be used in the annotation as follows.
@SqlResultSetMapping( name = “SampleMapping”, classes = { @ConstructorResult( targetClass = Smaple.class, columns = { @ColumnResult(name=”appId”, type=Int.class), @ColumnResult(name=”datetime”, type=Timestamp.class) } ) })
For Kotlin, omit the annotation in the annotation. Since @SqlResultSetMapping uses all of the above writing method, it suddenly tried to use this with Kotlin, so please refer it.
@SqlResultSetMapping( name = “SampleMapping”, classes = ( arrayOf( ConstructorResult( targetClass = Sample::class, columns = ( arrayOf( ColumnResult(name=”appId”, type=Int::class), ColumnResult(name=”datetime”, type=Timestamp::class) ) ) ) ) ))
Summary
It’s pretty simple to remember, but since I did not find any reference articles or examples implementing the Spring Boot application with Kotlin, I used a lot of time. This time I introduced only three points I was addicted to recently, but I will continue to add additional points if I find future addiction points.
