Extensions

Kotlin extensions provide the ability to extend existing classes with additional functionality. Spring Data Kotlin APIs use these extensions to add new Kotlin-specific conveniences to existing Spring APIs.

Keep in mind that Kotlin extensions need to be imported to be used. Similar to static imports, an IDE should automatically suggest the import in most cases.

For example, Kotlin reified type parameters provide a workaround for JVM generics type erasure, and Spring Data provides some extensions to take advantage of this feature. This allows for a better Kotlin API.