A cure for magic?
About me
👋 Hi, I'm Michael
👨💻 Backend Engineer here at gcx
📍 Dortmund
🏹 Spare-time archer
📚 Frequent Softwerkskammer.ruhr attendee
👨🍼 Father for 3 months now
Motivation
First there was Spring
… so much XML 😫
Then there was Spring Boot
… so slow 😫
… magic 😫🧙♂️😫
Enter Spring Fu
What is Spring Fu
What is Spring Fu
Different flavor
Won't replace anything
Antithesis to Magic
Everything is explicit
Everything is done in code
Fu is for Functional
Fu is for Functional
JaFu: for Java and Functional
JaFu was added later to the Fu family
IMO still not great for DSLs
KoFu: for Kotlin and Functional
I'll concentrate on KoFu
Shameless plug!
I'll talk about Kotlin for DSLs on KKON 🇩🇪
📆 12. Sept / 30. Sept
First look
Testing
… so that we can stress how easy and intuitive is with KoFu to enable only what you need to test, in contrast of traditional Spring boot, where you have to search for the right annotation that disables what you don’t need for the test.
– KoFu tutorial
Pros/Cons
What you win: simplicity
What you win: simplicity
when a project starts growing you may discover yourself spending more time configuring the framework, than building your business
– KoFu tutorial
Less magic → less short term productivity 📉
Less magic → less framework overhead 📈
What you win: startup performance
What you win: startup performance
40% faster than regular auto-configuration on a minimal Spring MVC app
– Spring Fu Readme
(almost) no reflections → easier native image
What you win: Petclinic example
What you win: Petclinic example
| Sample | JVM Memory | JVM Startup | Native Memory | Native Startup |
|---|---|---|---|---|
| Java with Annotations | 398M | 2.6s | 102M | 0.08s |
| Kotlin with KoFu | 298M | 1.6s | 81M | 0.08s |
| Δ | 100M | 1s | 21M | - |
What you loose: Magic
What you loose: Magic
AutoConfiguration
Spring Fu has (some) adapters: github
Package scan
Can work without Proxies
no AOP
What you loose: Features – "only"
What you loose: Features – "only"
Spring MVC / WebFlux / WebClient / Cors / Jackson or kotlin serialization / Thymeleaf and Mustache
JDBC, R2DBC / Redis / Cassandra / MongoDB
no JPA 😶
Configuration / Logging / Beans / Listeners
What you loose for now: Planned
What you loose for now: Planned
Scheduling 😭
WebSockets 😕
GraphQL 😶
… plenty more
What remains
What remains
Spring Boot infrastructure
Dependency Management
Starters
but AutoConfiguration won't be automatic
Acturators
Standalone JAR / container
It's experimental
It's experimental
Current focus is on native
"stalled", last release 05 Apr 2022
Rest assured that we will work on functional configurations again in the future, be it through Spring Fu, or in another form.
– Spring Fu Readme
Opinion
For serverless?
For serverless?
No/less reflection, package scan
→ faster startup
But: still "slow"
1.6s vs 0.08s
Serverless == native
For native?
For native?
No reflection/proxies/scan
Compile to native is easier to archive
But the current focus of spring is easy native compilation
For micro services?
For micro services?
100 MB memory can be a lot
21 MB can also be a lot!
Selling point: no magic?
Selling point: no magic?
Explicitness
Discoverability
Navigable
Maybe a pendulum
Maybe a pendulum
The pendulum had swung.
– Type Wars
Spring Boot was created because
someone wanted magic
Magic is not the problem
Magic is not the problem
Lack of explicitness
Lack of discoverability
Lack of knowledge
There is no magic 🤷♀️
There is no magic 🤷♀️
It's an excuse
Magic is the line where you stopped learning
chose to
were ordered to stop learning
Avoid simulation of simplicity
(term diverted from Security, Moore’s law, and the anomaly of cheap complexity)
Thank's for having me 🙇♂️
Slides are online!

https://slides.mene.dev/spring-foo-intro@20220803-spring-nrw