Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
"おまじない"はもう卒業! デバッガで探るSpring Bootの裏側と「学び方」の学び方
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
竹内 雅和
November 14, 2025
Technology
540
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
"おまじない"はもう卒業! デバッガで探るSpring Bootの裏側と「学び方」の学び方
竹内 雅和
November 14, 2025
More Decks by 竹内 雅和
See All by 竹内 雅和
Java正規表現エンジン(NFA)の仕組みと パフォーマンスを維持するための最適化手法
takeuchi_132917
0
300
Other Decks in Technology
See All in Technology
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
420
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
440
QA4AI 2026-Oct 生成AI時代の品質保証
tokuty
1
850
Local CI × GitHub Actions
gogutan
2
140
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
130
Metadata - Section 1: HTML Basics
mohab1
0
110
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
130
夫婦で子育てするための育児標準化
codmoninc
PRO
0
210
SAENM ~Jupyterで残すPoCの試行錯誤、未来の自分と仲間を助ける記録!~
terapyon
0
110
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2.3k
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
220
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.6k
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Practical Orchestrator
shlominoach
192
12k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
The Invisible Side of Design
smashingmag
301
52k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Transcript
"おまじない"はもう卒業! デバッガで探るSpring Bootの裏側と「学び方」の学び方 2025/11/15 JJUG CCC 2025 Fall #jjug_ccc_i 竹内
雅和 (@tm0920.bsky.social)
自己紹介 ・竹内 雅和 ・入社6年目 ・主にバックエンド担当 ・フロント/クラウドもちょっと触る ・Springの経験は3年くらい ・Bluesky:@tm0920.bsky.social ▪ 今回の資料
↓
目次 • 学びの停滞感について • ググっても解決しない問題との遭遇 • Springの基礎 • デバッグのコツ •
まとめ
学びの停滞感について • ”おまじない” • 「中級者への壁」
”おまじない” • @Autowired をつけると DIされる • @Transactional をつけるとトランザクションできる • @Controller,
@Service … • Service 層を実装するときは必ず IF を定義する
「中級者への壁」 • なぜ動くのか、説明できない • チュートリアル レベルの学習は終えた。 • 応用的な実装や、原因不明のエラーに遭遇すると手が止まる。 • ググっても、自分のケースに合う答えがなかなか見つからない…。
次に何をどう学べば良いの?
ググっても解決しない問題との遭遇 • 一般的に想定されるアプリとDB • 今回のPJのアプリとDB • ググってみても…。 • Mapperから先の処理が全く分からない…。 •
挫折ポイント
一般的に想定されるアプリとDB 接続先のDBは固定
今回のPJのアプリとDB ユーザー毎に接続先のDBが違う
ググってみても…。 • AbstractRoutingDataSource というクラスを使うらしい…。 • 自分の環境では上手く動かない…。 • 記事に書いてある説明の内容が全く分からない…。 Datasource、SpringManagedTransaction …???
Mapper から先の処理が全く分からなかった
背後に何かいる
ここを調べるには?
挫折ポイント(普通にデバッグしても追えない) MapperはInterfaceで定義 このメソッドを実装しているクラス?
挫折ポイント(普通にデバッグしても追えない) @Autowired で DIされて Mapperの実装クラスが入っているは ず。 ここにブレークポイント & ステップイン すれば良いのでは?
挫折ポイント(普通にデバッグしても追えない) UserMapperは…? updateOne() は…? invoke() なんて呼んでませ んけど…?
挫折ポイント(普通にデバッグしても追えない) UserMapperは…? updateOne() は…? invoke() なんて呼んでませ んけど…? 普通にデバッグしても追えない…
Springの基礎を知る • IoCとは • AOPとは • AOPを実現する仕組み
IoC とは ※ 参考:『Spring 徹底入門』(株式会社NTTデータ 著)
IoC とは ※ 参考:『Spring 徹底入門』(株式会社NTTデータ 著)
IoC とは ※ 参考:『Spring 徹底入門』(株式会社NTTデータ 著)
AOP とは ※ 参考:Spring AOP Tutorial for Beginners - Step
by Step with Example https://www.javaguides.net/2019/05/understanding-spring-aop-concepts-and-terminology-with-example.html
AOP とは ※ 参考:Spring AOP Tutorial for Beginners - Step
by Step with Example https://www.javaguides.net/2019/05/understanding-spring-aop-concepts-and-terminology-with-example.html
AOP とは ※ 参考:Spring AOP Tutorial for Beginners - Step
by Step with Example https://www.javaguides.net/2019/05/understanding-spring-aop-concepts-and-terminology-with-example.html
AOP とは ※ 参考:Spring AOP Tutorial for Beginners - Step
by Step with Example https://www.javaguides.net/2019/05/understanding-spring-aop-concepts-and-terminology-with-example.html
AOP とは
AOPとは ※ 参考:『Spring 徹底入門』(株式会社NTTデータ 著)
AOPを実現する仕組み ・IoCが管理するオブジェクト ( Bean )に対して、 AOPの実装を埋め込んでいる ・アプリからBeanを取得する時、Bean のインスタンスそのものではなく、 Proxyでラップされた状態で取得され る。
・Beanの処理を呼ぶ時に Proxyを経由して、AOPの処理を実行 している。 ※ 参考:『Spring 徹底入門』(株式会社NTTデータ 著)
仕組みを踏まえた上で処理を見ていく • Mapperから先の処理を見ていく • デバッグのコツ • デバッグを通して分かったこと
Mapperから先の処理を見ていく UserMapperは…? updateOne() は…? invoke() なんて呼んでませ んけど…?
Mapperから先の処理を見ていく UserMapperがラップされ たProxy Proxyのメソッドが呼ばれて る
デバッグのコツ • スタックトレースを読む • 変数を見る • ブレークポイントを貼ってみる • ステップ実行もしつつ繰り返して…
スタックトレースを読む
スタックトレースを読む
ブレークポイントを貼ってみる
変数を見てみる
ステップ実行もしつつ繰り返して…
BaseExecutor の update() を呼び出す
SimpleExecutor の doUpdate() を呼び出す
SimpleExecutor の prepareStatement() を呼び出す
BaseExecutor の getConnection() を呼び出す
SpringManagedTransaction の getConnection() を呼び出す
SpringManagedTransaction の openConnection() を呼び出す
DataSourceUtils の getConnection() を呼び出す
DataSourceUtils の doGetConnection() を呼び出す
DataSourceUtils の fetchConnection() を呼び出す
HikariDataSource の getConnection() を呼び出す
HikariPool の getConnection()を呼び出す
HikariPool の getConnection()を呼び出す
PoolEntry の createProxyConnection()を呼び出す
ProxyFactory の getProxyConnection()を呼び出す
HikariProxyConnectionのインスタンスを生成 ※ 一旦、呼び出し元を辿って戻ります。
RoutingStatementHandler の update() を呼び出す
PreparedStatementHandler の update() を呼び出す
PreparedStatementLogger の execute() を呼び出す
ProxyPreparedStatement の execute() を呼び出す
JdbcPreparedStatement の execute() を呼び出す
Command の executeUpdate() が呼ばれてSQLが実行される
デバッグを通して分かったこと • Mapperのメソッドが呼ばれてからSQLが実行されるまでの処理の流れ。 • DBとの接続(Connection)は DataSource の実装クラスで行われていること。 ◦ AbstractRoutingDataSource は
DataSource を実装した AbstractDataSourceを継承したクラス
【まとめ】フレームワークの裏側を探る『学び方』 • 例外をわざと発生させて、スタックトレースを読む。 • IDEのステップ実行と変数を参照して 内部のコードを追っていく。 • 内部のコードを追った後だと、技術記事の理解度が格段に上がる! • 「ステップアウト」で呼び出し元を辿って、
処理の流れを整理するのがオススメ。 • フレームワークの基礎的な設計思想を簡単に知っておくと デバッグしやすい。 • 「おまじないだから…」から少しずつ脱却していきましょう!
ご清聴ありがとうございました 質疑応答(例) • 前提知識として読んでおくと良い Springの公式ドキュメントや書籍? • 効率的に「当たり」をつけるためのコツ? (何でもどうぞ…!) (アンケートも書いてほしい…🙏→) 今回の資料
↓ 全体アンケート↓ セッションアンケート↓