Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
New in Spring 5: Functional Web Framework
Search
Arjen Poutsma
October 27, 2016
Programming
0
180
New in Spring 5: Functional Web Framework
Slides from Dutch Spring Meetup
Arjen Poutsma
October 27, 2016
Tweet
Share
More Decks by Arjen Poutsma
See All by Arjen Poutsma
Designing an API
poutsma
1
780
Other Decks in Programming
See All in Programming
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
200
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
300
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
270
チームのテスト力を総合的に鍛えて品質、スピード、レジリエンスを共立させる/Testing approach that improves quality, speed, and resilience
goyoki
5
920
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
5
1.1k
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
160
코딩 에이전트 체크리스트: Claude Code ver.
nacyot
0
530
Systèmes distribués, pour le meilleur et pour le pire - BreizhCamp 2025 - Conférence
slecache
0
120
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
270
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
530
Node-RED を(HTTP で)つなげる MCP サーバーを作ってみた
highu
0
120
Advanced Micro Frontends: Multi Version/ Framework Scenarios @WAD 2025, Berlin
manfredsteyer
PRO
0
160
Featured
See All Featured
Writing Fast Ruby
sferik
628
62k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
Visualization
eitanlees
146
16k
Raft: Consensus for Rubyists
vanstee
140
7k
Testing 201, or: Great Expectations
jmmastey
43
7.6k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Unsuck your backbone
ammeep
671
58k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Become a Pro
speakerdeck
PRO
29
5.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
A Tale of Four Properties
chriscoyier
160
23k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
Transcript
New in Spring 5: Functional Web Framework Arjen Poutsma Pivotal
About Arjen • Twenty years of experience in Enterprise Software
Development • Joined SpringSource in 2005 • Development lead of Spring Web Services, Spring MVC, Spring Scala • Working on Spring 5
I do like annotations...
...but there are downsides • “Magic” • No clear link
between annotation and behavior • Runtime handling • Reflection
Design Goals • Functional Style • java.util.function • java.util.stream •
More library; less framework • Explicit • Customizable • No reflection
Functional Programming (in Java 8)
Immutability • No change after construction • Builders • Thread-safety
•e.g. String •toUpperCase() •StringBuilder
First-class Functions • Functions as first-class citizens • Functions as
arguments • Functions as return value • Reusability •e.g. String •indexOf(char) vs indexOf(Predicate<Char>)
Pure Functions • Same result given same arguments • No
Limit side effects • Application boundaries • Testability • Cacheability • Parallelization
Who likes this?
Function<ServerRequest, ServerResponse<T>> HandlerFunction h(Req) ! Res
ServerRequest • Similar to RequestEntity • Immutable • Headers •
Optional<MediaType> contentType() • List<String> header(String) • Body • Mono<T> bodyToMono(Class<T>)
ServerResponse • Similar to ResponseEntity • Immutable w/ Builder •
Headers • lastModified(ZonedDateTime) • header(String, String...) • Body • body(Publisher<T>, Class<T>)
Demo
Function<Request, Optional<HandlerFunction<T>> RouterFunction r(Req) ! ⇢ h(Req) ! Res ;
RequestPredicate Predicate<Request>
RequestPredicates • Common predicates • path • headers (Content-Type, Accept)
• Build (compose) your own!
Demo
BiFunction<Request,HandlerFunction<T>, Response<R>> HandlerFilterFunction f ( Req, h ( x ))
! Res
Demo
Running a Server • Convert RouterFunction to HttpHandler • HttpHandler
runs • Reactor Netty • RxNetty • Servlet 3.1 • Undertow
Demo
Summary • Handler functions handle request by returning a response
• Router functions route to handler functions • Router functions can be filtered by filter functions • Router functions can be run in a reactive web runtime
Who likes this?
Q & A