3
3

More than 1 year has passed since last update.

Spring Boot 依存関係について

Posted at

はじめに

今回は、Spring BootでのWEBアプリケーション開発で、最低限の必要になる依存関係について書いていきます。

依存関係とは

Spring Bootで開発を進める上で、様々な機能を提供してくれるものです。
今回はGradleを使っていきます。

最低限必要になる依存関係

こちらの機能があれば、簡単なWEBアプリケーションが作れます。
ざっくり説明していくとこんな感じです。

依存関係名  機能説明 
Spring Boot DevTools 開発用の機能を提供するライブラリ。アプリケーション起動中にコードを編集した場合に自動的に反映するホットリロードを使用するために導入する。
Lombok Getter/Setterなど機械的に作成するメソッドをアノテーションのみで自動生成するライブラリ。単純作業になるコードを削減するために導入する。
Spring Web WEBアプリケーションを開発するために必要な機能を提供する。WebAPI開発には必須。
Spring Data JDBC RDBMSに接続するために必要な機能を提供する。
MyBatis Framework RDBMSへの操作を楽にするためのORM(Object Relational Mapping)機能を提供する。
H2 Database JVM上で動作するRDBMSを提供する。開発効率が良くなるため、9章でMySQLを導入するまでの間利用する。
Spring Security ログイン機能やサインイン機能などを実装するためには必須
Validation WEBアプリケージョンでよく使われるバリデーションを実装するために必要
thymeleaf Spring Bootのアプリケーションでは必須になるテンプレートエンジン
spring boot starter test Spring Bootでのテスト機能を実装する際に必要になる。

少々抜けているものもあるかと思いますが、以上の依存関係はSpring BootのWEBアプリケーション開発では必須になるものです。

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-security:2.7.1'
	implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server:2.7.1'
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-validation'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.0'
	implementation 'org.springframework.cloud:spring-cloud-starter'
	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
	runtimeOnly 'com.h2database:h2'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

レイアウト作成に役立つ依存関係

こちらは、BootStrap、FontAwesome、jqueryの依存関係です。

implementation 'org.webjars:bootstrap:4.3.1'
implementation group: 'org.webjars', name: 'jquery', version: '3.3.1'
implementation 'org.webjars:font-awesome:5.13.0'

以上になります。

3
3
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
3
3