12
@nicolas_frankel Migrating Spring Boot apps From Annotation-based Config to Functional with Kotlin

Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

Migrating SpringBoot apps

From Annotation-based Configto Functional with Kotlin

Page 2: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

Me, myself and I

● Kotlin fan

● Spring Boot lover

Page 3: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

European alternative to the “big” cloud-computing

players

● Privacy-minded

● Great support

Page 4: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

Spring Boot

● Open Source

● Pivotal

● Spring Framework

● Convention over

configuration

Page 5: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

The issue

● Magic○ Via annotations

● The solution?○ Functional configuration

Page 6: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

Time for DEMO

Page 7: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

Going further

● Spring Fu○ Ko-Fu

○ Ja-Fu

● Experimental!

Page 8: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

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!

Kofu configuration for Spring Boot

Page 9: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

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!

Page 10: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

Takeaways

● Controller to routes○ Logic in handlers

● Kotlin Beans DSL

● Kotlin Routes DSL

● No more necessary to be

reactive

Page 11: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

Page 12: Migrating Spring Boot apps · Based on Spring Boot infrastructure used in a functional way No feature enabled based on classpath detection Both declarative and programmatic Faster

@nicolas_frankel

Thanks!

● https://blog.frankel.ch/

● @nicolas_frankel

● https://git.io/fN3Qv