SPRING BOOT AND
KOTLIN, A MATCH
MADE IN HEAVEN
@NICOLAS_FRANKEL
SWITZERLAND
@nicolas_frankel #kotlin #springboot
SWITZERLAND
@nicolas_frankel #kotlin #springboot
SWITZERLAND
@nicolas_frankel #kotlin #springboot
ME, MYSELF AND I
@nicolas_frankel #kotlin #springboot
 Developer/Software -
/Solution Architect
• Java
• As consultant
HYBRIS, AN SAP COMPANY
@nicolas_frankel #kotlin #springboot
@nicolas_frankel #kotlin #springboot
@nicolas_frankel #kotlin #springboot
WHY SPRING BOOT?
@nicolas_frankel #kotlin #springboot
Convention over
configuration
• Kickstart a project in minutes,
not days
Out-of-the-box features
• Actuator
@nicolas_frankel #kotlin #springboot
KOTLIN
@nicolas_frankel #kotlin #springboot
Open Source
Compiles to
• JVM bytecode
• JavaScript (experimental)
A "simpler Scala"
@nicolas_frankel #kotlin #springboot
KOTLIN MAIN FEATURES
@nicolas_frankel #kotlin #springboot
Functional and object-oriented
Statically typed
Null safety
No checked exceptions
Named & optional arguments
Lambdas
Extension functions
Java compatibility
(And more...)
@nicolas_frankel #kotlin #springboot
KOTLIN MAIN BENEFITS
@nicolas_frankel #kotlin #springboot
More expressive than Java
Improved OO
Functional too
HELLO KOTLIN!
package hello // no semicolons
// namespace-level functions
// types on the right
// no special syntax for arrays
// optional return type
fun main(args: Array<String>) {
println("Hello Kotlin!")
}
@nicolas_frankel #kotlin #springboot@nicolas_frankel #kotlin #springboot
THE KILLER FEATURE: EXTENSIONS
@nicolas_frankel #kotlin #springboot
Extension methods
Extension properties
EXTENSION METHOD
@nicolas_frankel #kotlin #springboot
Add new methods on an
existing type
Called like a method on the
type
Translated to static Util
method in the bytecode
ENOUGH TALK…
@nicolas_frankel #kotlin #springboot
SPRING BOOT KOTLIN INTEGRATION
@nicolas_frankel #kotlin #springboot
Kotlin integration OOTB
Code more terse
Java configuration files less
verbose
ENOUGH TALK…
@nicolas_frankel #kotlin #springboot
MY PROJECT
@nicolas_frankel #kotlin #springboot
Migrating my WordPress
blog to Jekyll
• From one single XML export
• To a Markdown file per post
TYPICAL BATCH SCENARIO
@nicolas_frankel #kotlin #springboot
Read
• XML file
Transform
• Add image size
• Replace links
• Etc.
Write
• Markdown files
HIGHLIGHTS
@nicolas_frankel #kotlin #springboot
Expression body methods
Many one-liners into one
file
Expression properties
KEY TAKEAWAYS
@nicolas_frankel #kotlin #springboot
Q&A
@nicolas_frankel #kotlin #springboot
http://blog.frankel.ch/
@nicolas_frankel
http://frankel.in/
https://git.io/vVSLG

Morning at Lohika - Spring Boot Kotlin, a match made in Heaven