0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【個人学習】boot_two_saleのBootTwoSaleApplication.javaを読んでSpring Bootの起動・エントリーポイントの仕組みを理解した

0
Posted at

対象ファイル

  • src/main/java/co/kr/sale/BootTwoSaleApplication.java

はじめに

今回は boot_two_sale プロジェクトのエントリーポイントである BootTwoSaleApplication.java を分析した。
Spring Boot アプリケーションの起動プロセスや、アノテーションによる自動設定、コンポーネントスキャンの仕組みなど、システム全体の起点となるクラスの構成について整理してみた。

概要 / 基本情報 / 詳細な解説テーブル

co.kr.sale.BootTwoSaleApplication は、Spring Boot アプリケーションの起動および設定を統括するメインのエントリーポイントクラスである。

  • ファイルパス: src/main/java/co/kr/sale/BootTwoSaleApplication.java
  • 種別: Class (Spring Boot Main Application)
  • 主要アノテーション: @SpringBootApplication
  • 依存関係: org.springframework.boot.SpringApplication, org.springframework.boot.autoconfigure.SpringBootApplication

処理フローの詳細 (5段階 Web 動作フロー)

  1. Request (アプリケーション起動トリガー): 開発者またはサーバーマネージャーがアプリケーションの main メソッドを実行。
  2. Controller / Context (コンテナ初期化): Spring の SpringApplication.run() が呼び出され、IoC Container および組込みサーブレットコンテナ(Tomcat)の初期化を開始。
  3. DAO / Service (自動設定スキャン): @SpringBootApplication により、同一パッケージおよび配下にあるコンポーネントやマッパー、設定クラスが自動スキャンされ Bean として登録。
  4. DTO & Model (リソース準備): アプリケーション稼働に必要なデータベース接続プールや MVC ビューリゾルバの構成を適用。
  5. View Response (稼働状態移行): サーバーが指定ポート(9994番等)でリクエストを受け付ける準備を完了し、Web アプリケーションが起動。

気になった部分・改善ポイント (Refactoring Notes)

  • 標準的なブートストラップ構成: Spring Boot のベストプラクティスに則った最小限かつ標準的な構成となっており、自動設定(Auto-Configuration)機能が正常に機能する理想的な形。
  • 特記事項なし: エントリーポイントとしての役割に特化しているため、現段階での追加リファクタリングやロジック分離の必要性はない。

構成要素のまとめ

メソッド名 戻り値の型 パラメータ 役割・説明
main() void String[] args Java アプリケーションの標準エントリポイントであり、Spring Boot の内蔵サーバーを起動

今回学んだこと

  • boot_two_sale プロジェクトにおけるメインアプリケーションクラスの役割と、@SpringBootApplication による自動設定・コンポーネントスキャンの仕組みを把握できた。
  • アプリケーション起動から組み込み Tomcat の立ち上がり、各種リソースの初期化に至る一連の 5 段階 Web 動作フローを再確認できた。
  • 次のファイル分析へと進んでいきたい。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?