In the latest years, there has been some push-back against frameworks, and more specifically annotations: some call them magic. Obviously, they make understanding the flow of the application harder. Spring and Spring Boot latest versions go along this trend, by offering an additional way to configure beans with explicit code instead of annotations. It's declarative in the sense it looks like configuration, though it's based on Domain-Specific Language(s). This talk aims to demo a step-by-step process to achieve that.
2. @nicolas_frankel
• Developer, team lead, architect,
whatever it takes
• Recently Developer Advocate
• Love Spring
• Love Kotlin
Me, myself and I
3. @nicolas_frankel
Hazelcast
HAZELCAST IMDG is an operational,
in-memory, distributed computing
platform that manages data using
in-memory storage, and performs
parallel execution for breakthrough
application speed and scale.
HAZELCAST JET is the ultra fast,
application embeddable, 3rd
generation stream processing
engine for low latency batch
and stream processing.
4. @nicolas_frankel
• Open Source
• Backed by Pivotal
• Built on the shoulders of the
Spring framework
• Convention over configuration
Spring Boot
5. @nicolas_frankel
• Magic
• Via annotations
• Solution:
• Remove annotations
• Functional configuration for the win
The issue
8. @nicolas_frankel
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
9. @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
12. @nicolas_frankel
• Controller to routes
• Logic in handlers
• Kotlin Beans DSL
• Kotlin Routes DSL
• Reactive is not necessary
anymore… till a point
Takeaways