$30 off During Our Annual Pro Sale. View Details »
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
マスタデータ問題、マイクロサービスでどう解くか
kts
0
120
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
190
JETLS.jl ─ A New Language Server for Julia
abap34
2
440
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
6
3.9k
ゲームの物理 剛体編
fadis
0
370
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
360
Jetpack XR SDKから紐解くAndroid XR開発と技術選定のヒント / about-androidxr-and-jetpack-xr-sdk
drumath2237
1
190
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
630
俺流レスポンシブコーディング 2025
tak_dcxi
14
9.5k
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
610
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
170
AIエージェントの設計で注意するべきポイント6選
har1101
5
2.1k
Featured
See All Featured
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.3k
Tell your own story through comics
letsgokoyo
0
760
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Visualization
eitanlees
150
16k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
190
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
115
91k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Balancing Empowerment & Direction
lara
5
820
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
89
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
71
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
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