This repository contains a Spring Boot Batch application that demonstrates how to efficiently process CSV data and store it in a MySQL database. This can be a valuable tool for handling large datasets and automating data import tasks.
- Prerequisites
- Getting Started
- Project Structure
- Configuration
- Running the Application
- Contributing
- License
Before you begin, ensure you have met the following requirements:
- Java Development Kit (JDK) installed (at least Java 8).
- MySQL installed and running.
- Basic knowledge of Spring Boot, Spring Batch, and MySQL.
Clone this repository to your local machine:
bash
git clone https://github.com/swapniltake1/csvtomysql.git
The project structure follows standard Spring Boot conventions:
src/main/java
: Contains the Java source code.src/main/resources
: Contains configuration files, including the application.properties file for database configuration.src/test
: Contains test classes.
Before running the application, configure the MySQL database connection in the src/main/resources/application.properties
file:
spring.datasource.url=jdbc:mysql://localhost:3306/your-database-name
spring.datasource.username=your-username
spring.datasource.password=your-password
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
You can also customize other batch-related configurations in this file.
To run the application, use the following commands:
./mvnw clean package
java -jar target/spring-boot-batch-csv-to-mysql-1.0.0.jar
Replace spring-boot-batch-csv-to-mysql-1.0.0.jar
with the actual JAR file generated.
The application will read data from a sample CSV file (data.csv
), process it, and store it in the configured MySQL database.
Contributions are welcome! If you'd like to enhance this project or fix any issues, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature
orgit checkout -b bugfix/issue-number
. - Make your changes and commit them:
git commit -m 'Your changes'
. - Push your changes to your fork:
git push origin feature/your-feature
. - Submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.