Skip to content

Commit 63eafec

Browse files
feat: shell to bash
1 parent 83b4928 commit 63eafec

File tree

3 files changed

+178
-54
lines changed

3 files changed

+178
-54
lines changed

README.md

Lines changed: 110 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Spring Boot 2からの移行、または新規開発において、最新のバ
3939
---
4040

4141
## 🗂️ Project Structure / プロジェクト構成
42-
```plaintext
42+
```bash
4343
.
4444
├── dbAndCsvBatch # DB to CSV and CSV to DB batch jobs
4545
│   ├── src
@@ -62,39 +62,141 @@ Spring Boot 2からの移行、または新規開発において、最新のバ
6262
- Docker for setting up the MySQL environment.
6363

6464
### 1. Clone the repository
65-
```shell
65+
```bash
6666
git clone https://github.com/kinto-technologies/SpringBoot3BatchStarter.git
6767
```
6868

6969
### 2. Build the skeleton batch
70-
```shell
70+
```bash
7171
cd skeletonBatch
7272
../gradlew
7373
```
7474

7575
### 3. Run the skeleton batch
76-
```shell
76+
```bash
7777
java -jar build/libs/skeletonBatch-*.jar
7878
```
7979

8080
### 4. Set up the MySQL database for DB and CSV batch
81-
```shell
81+
```shell# Spring Batch3 Starter - Accelerate Your Spring Boot 3 Batch Development🚀
82+
83+
## Overview / 概要
84+
85+
This repository is a Spring Batch Starter Kit tailored for Spring Boot 3. It simplifies batch job development with the latest Spring Batch 5 features, ensuring compatibility with Spring Boot 3. Whether you’re upgrading from Spring Boot 2 or starting fresh, this project equips you to leverage the enhanced capabilities of Spring Batch.
86+
87+
このリポジトリは Spring Boot 3 および Spring Batch 5 の最新機能を活用して、バッチ処理の開発を効率化するためのスターターキットです。
88+
Spring Boot 2からの移行、または新規開発において、最新のバッチ処理フレームワークをすぐに使い始めることができます。
89+
90+
### Key Highlights
91+
- **Skeleton Batch Framework**: Quickly develop custom batch jobs with minimal setup.
92+
- **DB to CSV Batch**: Export data from MySQL to CSV files seamlessly.
93+
- **CSV to DB Batch**: Import CSV data into MySQL efficiently.
94+
95+
### 主な特徴
96+
- **スケルトンバッチ**: 業務ロジックを追加するだけでバッチを簡単に構築可能。
97+
- **DB to CSVバッチ**: MySQLからCSVファイルへのデータ出力します。where句を実行時引数で指定可能。
98+
- **CSV to DBバッチ**: CSVデータをMySQLにバルクで登録します。
99+
100+
---
101+
102+
## 💡 Key Features / 特徴
103+
104+
### 🚀 Batch Development Made Simple
105+
- **Spring Batch Framework**: Streamlined job and step management.
106+
- **JOOQ ORM**: SQL-like query writing and entity generation, eliminating boilerplate code.
107+
- **OpenCSV Integration**: Hassle-free CSV file handling.
108+
- **Multi-Database Support**: H2 for metadata management and MySQL for business data.
109+
110+
### ⚙️ Flexibility and Optimization
111+
- **Dynamic Configurations**: Environment-specific setups with profiles (local/server).
112+
- **Customizable Batches**: Execute multiple jobs within a single JAR by passing runtime arguments.
113+
- **Google Java Format**: Automated code formatting with Spotless.
114+
115+
### 💼 Future-Proof Design
116+
- **Skeleton Batch Framework**: A template for creating new batch jobs.
117+
- **Pre-configured Docker Environment**: Quickly set up a local MySQL database with Docker Compose.
118+
119+
---
120+
121+
## 🗂️ Project Structure / プロジェクト構成
122+
```bash
123+
.
124+
├── dbAndCsvBatch # DB to CSV and CSV to DB batch jobs
125+
│   ├── src
126+
│   │   ├── main
127+
│   │   └── test
128+
│   ├── build.gradle # Gradle configuration for dbAndCsvBatch module
129+
│   ├── compose.yaml # Docker Compose file for MySQL container
130+
│   └── init-scripts # SQL scripts to initialize the database
131+
└── skeletonBatch # A skeleton batch example for future extensions
132+
├── src
133+
│   ├── main
134+
│   └── test
135+
├── build.gradle # Gradle configuration for skeletonBatch module
136+
└── README.md # Detailed documentation for skeletonBatch
137+
```
138+
139+
## 🚀 Getting Started / はじめに
140+
### Prerequisites
141+
- Java 17+ for Spring Boot 3.
142+
- Docker for setting up the MySQL environment.
143+
144+
### 1. Clone the repository
145+
```bash
146+
git clone https://github.com/kinto-technologies/SpringBoot3BatchStarter.git
147+
```
148+
149+
### 2. Build the skeleton batch
150+
```bash
151+
cd skeletonBatch
152+
../gradlew
153+
```
154+
155+
### 3. Run the skeleton batch
156+
```bash
157+
java -jar build/libs/skeletonBatch-*.jar
158+
```
159+
160+
### 4. Set up the MySQL database for DB and CSV batch
161+
```bash
82162
cd ../dbAndCsvBatch
83163
docker compose up -d
84164
```
85165
### 5. Build the DB and CSV batch jobs
86-
```shell
166+
```bash
167+
cd ../dbAndCsvBatch
168+
../gradlew
169+
```
170+
171+
### 6. Run Db to CSV Batch
172+
```bash
173+
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=DB_TO_CSV --spring.profiles.active=local
174+
```
175+
176+
### 7. Run CSV to DB Batch
177+
```bash
178+
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=CSV_TO_DB --spring.profiles.active=local
179+
```
180+
181+
#### With this Spring Batch Starter Kit, you can focus on your business logic while the framework handles the heavy lifting. Happy coding! 🎉
182+
```bash
183+
cd ../dbAndCsvBatch
184+
docker compose up -d
185+
```
186+
187+
### 5. Build the DB and CSV batch jobs
188+
```bash
87189
cd ../dbAndCsvBatch
88190
../gradlew
89191
```
90192

91193
### 6. Run Db to CSV Batch
92-
```shell
194+
```bash
93195
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=DB_TO_CSV --spring.profiles.active=local
94196
```
95197

96198
### 7. Run CSV to DB Batch
97-
```shell
199+
```bash
98200
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=CSV_TO_DB --spring.profiles.active=local
99201
```
100202

dbAndCsvBatch/README.md

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,88 @@
1-
# dbAndCsvBatch / データベースとCSVのバッチ処理
1+
# dbAndCsvBatch - Database and CSV Batch Processing / データベースとCSVのバッチ処理 🚀
2+
3+
This module provides practical batch processing samples for:
24

3-
This module provides sample batch processing implementations for:
45
このモジュールは以下のバッチ処理サンプルを提供します:
56
1. Exporting data from a database to a CSV file (DB to CSV).
67
データベースからCSVファイルを生成します (DB to CSV)。
78
2. Importing data from a CSV file into a database (CSV to DB).
89
CSVファイルからデータベースにデータを登録します (CSV to DB)。
910

10-
## Docker
11-
Note: If you cannot use Docker, please download and install Docker from Docker's official website.
12-
Follow the instructions provided for your operating system.
13-
14-
注釈: Dockerコマンドが使用できない場合は、[Dockerの公式サイト](https://www.docker.com/get-started)からダウンロードしてインストールしてください。
11+
## 🐳 Docker Setup
12+
If Docker is not available, download it from the official Docker website. Follow the installation instructions for your operating system.
13+
注記: Dockerが使用できない場合は、Dockerの公式サイトからダウンロードし、手順に従ってインストールしてください。
1514

1615
## How to Run / 実行方法
16+
Steps:
17+
1. Navigate to the dbAndCsvBatch directory:
1718
```bash
1819
cd dbAndCsvBatch
19-
20-
## Local環境にMySQLコンテナを作成する
21-
## Create a MySQL container for the local environment
20+
```
21+
22+
2. Build and run the MySQL container:
23+
```bash
2224
docker compose down && docker compose build && docker compose up -d
25+
```
2326

24-
## MySQLコンテナに接続して、テーブルとレコードの確認
25-
## Connect to the MySQL container and check tables and records
27+
3. Connect to the MySQL container and verify the setup:
28+
```bash
2629
docker exec -it mysql-container mysql -u sampleuser -psamplepassword sampledb
2730

2831
mysql> show databases;
32+
2933
mysql> show tables;
34+
3035
mysql> SELECT * FROM member;
36+
3137
mysql> SELECT * FROM member WHERE delete_flag = 0 AND type IN (1, 2, 3) ORDER BY type ASC;
38+
3239
mysql> exit;
40+
```
41+
## 💻 How to Run / 実行方法
3342

34-
# DBからEntityクラスを生成した後に実行可能JARを作成するように、default taskを設定している
35-
# Generate the JAR file by executing the default task after creating entity classes from the database
43+
Step-by-Step Guide
44+
1. Generate the JAR file
45+
Execute the default task to generate the Spring Boot JAR file:
46+
```bash
3647
../gradlew
48+
```
49+
50+
2. Verify Generated Files
51+
Confirm that the entity classes and JAR file were successfully created:
3752

38-
# EntityクラスがDBから自動生成された事を確認
39-
# Verify that the Entity classes were generated from the database
53+
```bash
54+
# Check generated entity classes
4055
ls -R build/generated-src/jooq
4156

42-
# spring boot jarファイルが生成されていることを確認
43-
# Verify that the Spring Boot JAR file has been generated
57+
# Verify the generated Spring Boot JAR
4458
ls -ls build/libs/dbAndCsvBatch-*.jar
59+
```
4560

46-
47-
## for local
48-
## DBからCSVファイルを生成するバッチを起動
49-
## Run the batch job to generate a CSV file from the database
61+
3. Run Batch Jobs
62+
### For Local Environment
63+
- Export data from DB to CSV:
64+
```bash
5065
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=DB_TO_CSV --spring.profiles.active=local
66+
```
5167

52-
## 実行時引数を指定してバッチを起動する場合
53-
## When invoking a batch with runtime arguments
68+
- Run batch with custom runtime arguments:
69+
```bash
5470
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=DB_TO_CSV --batch.types=2,4 --spring.profiles.active=local
71+
```
5572

56-
## CSVファイルからDBに登録するバッチを起動
57-
## Run the batch job to import data from a CSV file into the database
73+
- Import data from CSV to DB:
74+
```bash
5875
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=CSV_TO_DB --spring.profiles.active=local
76+
```
5977

60-
----
61-
62-
## for server
63-
## DBからCSVファイルを生成するバッチを起動
64-
## Run the batch job to generate a CSV file from the database
78+
### For Server Environment
79+
- Export data from DB to CSV:
80+
```bash
6581
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=DB_TO_CSV --spring.profiles.active=server
82+
```
6683

67-
## CSVファイルからDBに登録するバッチを起動
68-
## Run the batch job to import data from a CSV file into the database
84+
- Import data from CSV to DB:
85+
```bash
6986
java -jar build/libs/dbAndCsvBatch-*.jar --spring.batch.job.name=CSV_TO_DB --spring.profiles.active=server
7087
```
88+
With this module, you can seamlessly integrate database and CSV operations into your Spring Boot batch applications. Happy coding! 🎉

skeletonBatch/README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
# Skeleton Batch - Spring Batch Template
1+
# Skeleton Batch - Spring Batch Template 🚀
22

3-
## Overview / 概要
4-
The skeletonBatch module is a simple and efficient template for creating custom batch jobs using Spring Batch.
5-
By adding your own business logic, you can quickly complete a fully functional Spring Boot 3 batch application.
3+
## Overview / 概要 🌟
64

7-
skeletonBatch モジュールは、Spring Batch を使用してカスタムバッチジョブを簡単かつ効率的に作成するためのテンプレートです。
8-
業務ロジックを追加するだけで、完成されたSpring Boot 3バッチアプリケーションを素早く構築できます。
5+
The skeletonBatch module is a streamlined template designed to help you create custom batch jobs effortlessly with Spring Batch.
6+
Simply add your business logic, and you’ll have a fully operational Spring Boot 3 batch application in no time.
97

8+
SkeletonBatch モジュールは、Spring Batch を使って簡単かつ効率的にカスタムバッチジョブを作成するためのテンプレートです。
9+
業務ロジックを追加するだけで、すぐに動作する Spring Boot 3 バッチアプリケーションを構築できます。
1010
---
1111

12-
## How to Run / 実行方法
12+
## How to Run / 実行方法 🔧
13+
14+
Step-by-step Instructions
1315
```bash
16+
# Navigate to the skeletonBatch directory
1417
cd skeletonBatch
1518

16-
# 実行可能JARを作成するように、default taskを設定している
17-
# Generate the JAR file by executing the default task.
19+
# Execute the default task to generate the JAR file
1820
../gradlew
1921

20-
# spring boot jarファイルが生成されていることを確認
21-
# Verify that the Spring Boot JAR file has been generated
22+
# Confirm that the Spring Boot JAR file has been generated
2223
ls -ls build/libs/skeletonBatch-*.jar
2324

24-
## スケルトンのバッチを起動
25-
## Run the batch job to skeleton
25+
# Run the skeleton batch application
2626
java -jar build/libs/skeletonBatch-*.jar
2727
```
28+
## Highlights / 特徴 ✨
29+
- Simple Setup: Pre-configured tasks for quick builds.
30+
- Fast Execution: Minimal effort to start your batch job.
31+
- Customizable: Extend the template with your business logic.

0 commit comments

Comments
 (0)