1 of 12

Kotlin and Spring Boot

A path toward a more declarative configuration

@nicolas_frankel

2 of 12

Me, myself and I

  • Kotlin fan
  • Spring Boot lover

@nicolas_frankel

3 of 12

European alternative to the “big” cloud-computing players

  • Privacy-minded
  • Great support

@nicolas_frankel

4 of 12

Spring Boot

  • Open Source
  • Pivotal
  • Spring Framework
  • Convention over configuration

@nicolas_frankel

5 of 12

The issue

  • Magic
    • Via annotations
  • The solution?
    • Functional configuration

@nicolas_frankel

6 of 12

Time for DEMO

@nicolas_frankel

7 of 12

Takeaways

  • Reactive all the way down
  • Controller to routes
    • Logic in handlers
  • Kotlin Beans DSL
  • Kotlin Routes DSL

@nicolas_frankel

8 of 12

Going further

  • Spring Fu
    • Kofu
    • Jafu
  • Experimental!

@nicolas_frankel

9 of 12

Kofu configuration for Spring Boot

Kofu configuration is currently developed in Spring Fu, an incubator intended to ultimately contribute features related to Kotlin and functional configuration to Spring Framework, Boot and Data.

Direct from Spring One!

@nicolas_frankel

10 of 12

Kofu configuration for Spring Boot

  • Explicit configuration via a Kotlin DSL
  • Based on Spring Boot infrastructure used in a functional way
  • No feature enabled based on classpath detection
  • Both declarative and programmatic
  • Faster startup and lower memory consumption
  • Minimal reflection & annotations usage
  • Pure lambdas, no CGLIB proxy

Direct from Spring One!

@nicolas_frankel

11 of 12

@nicolas_frankel

12 of 12

Thanks!

  • https://blog.frankel.ch/
  • @nicolas_frankel
  • https://git.io/fN3Qv

@nicolas_frankel