https://github.com/aditya-620/todo-web-application-springboot
๐ A simple Todo Web Application built with Spring Boot, Spring Security, Spring Data JPA, and H2. Features include user authentication, CRUD operations, validation, and a responsive Bootstrap UI.
https://github.com/aditya-620/todo-web-application-springboot
bootstrap h2-database jpa jsp spring-boot spring-data-jpa spring-mvc spring-security
Last synced: about 2 months ago
JSON representation
๐ A simple Todo Web Application built with Spring Boot, Spring Security, Spring Data JPA, and H2. Features include user authentication, CRUD operations, validation, and a responsive Bootstrap UI.
- Host: GitHub
- URL: https://github.com/aditya-620/todo-web-application-springboot
- Owner: aditya-620
- Created: 2025-02-08T23:41:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-06T20:36:18.000Z (about 1 year ago)
- Last Synced: 2025-04-06T21:30:21.385Z (about 1 year ago)
- Topics: bootstrap, h2-database, jpa, jsp, spring-boot, spring-data-jpa, spring-mvc, spring-security
- Language: Java
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Todo Web Application - Spring Boot
This is a simple **Todo Web Application** built using **Spring Boot**. It allows users to manage their tasks with features like adding, updating, and deleting todos. The project leverages **Spring MVC**, **Spring Security**, **Spring Data JPA**, and an **H2 in-memory database** for fast and easy development.
---
## ๐ Features
- ๐ **User Authentication**: Secured login with in-memory user details via Spring Security.
- ๐ **CRUD Operations**: Create, Read, Update, and Delete todos.
- โ
**Validation**: Form validation for cleaner user input.
- ๐ฑ **Responsive UI**: Designed with Bootstrap for a modern and responsive layout.
- ๐๏ธ **In-Memory Database**: Uses H2 for rapid setup and testing.
- ๐
**Date Picker**: Bootstrap-integrated date picker for selecting target dates.
---
## ๐ Project Structure
### ๐ Controllers
- `WelcomeController`: Manages the welcome page and user session.
- `TodoControllerJpa`: Handles todo-related CRUD operations using JPA.
- `SayHelloController`: Demonstrates simple Spring MVC functionality.
### โ๏ธ Services
- `TodoService`: Contains business logic for managing todos (non-JPA implementation).
### ๐๏ธ Repositories
- `TodoRepository`: Interface for data access using Spring Data JPA.
### ๐ฆ Entities
- `Todo`: Represents the todo model with fields such as `id`, `username`, `description`, `targetDate`, and `done`.
---
## โ
Prerequisites
- Java 17 or higher
- Maven (or use the Maven Wrapper)
---
## ๐ ๏ธ Getting Started
### 1. Clone the Repository
```bash
git clone
cd Todo-Web-Application-SpringBoot
```
### 2. Build the Project
```bash
./mvnw clean install
```
### 3. Run the Application
```bash
./mvnw spring-boot:run
```
- Maven (or use the Maven Wrapper)
---
## ๐ Application Endpoints
### ๐ Public Endpoints
- `GET /say-hello`
Returns a simple `"Hello"` message.
- `GET /say-hello-html`
Returns a basic HTML page.
- `GET /say-hello-jsp`
Renders a JSP page.
---
### ๐ Secured Endpoints (require login)
- `GET /`
Welcome page after login.
- `GET /list-todos`
View the list of todos.
- `GET /add-todo`
Add a new todo item.
- `POST /update-todo?id={id}`
Update an existing todo with the specified ID.
- `POST /delete-todo?id={id}`
Delete a todo with the specified ID.
---
## ๐พ Database
This application uses an **H2 in-memory database** for development and testing.
- **H2 Console:** [http://localhost:8080/h2-console](http://localhost:8080/h2-console)
---
## ๐งฐ Technologies Used
- **Spring Boot** โ Core framework
- **Spring MVC** โ Web layer and controller routing
- **Spring Security** โ Handles authentication and authorization
- **Spring Data JPA** โ ORM and data persistence abstraction
- **H2 Database** โ Lightweight in-memory DB for quick development
- **Bootstrap** โ Frontend styling and responsive design
- **JSP** โ View rendering on the server side
---
## โ๏ธ Configuration
### `application.properties`
```properties
# View resolver settings
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
# H2 database configuration
spring.datasource.url=jdbc:h2:mem:testdb
# Date formatting
spring.mvc.format.date=yyyy-MM-dd
---
## ๐งช Running Tests
To run all tests, use the following command:
```bash
./mvnw test
```
---
## ๐ Folder Structure
```
Todo-Web-Application-SpringBoot/
โโโ src/
โ โโโ main/
โ โ โโโ java/
โ โ โ โโโ com.adityarastogi.springboot.Todo_Web_Application_SpringBoot/
โ โ โ โโโ todo/ # Todo-related logic
โ โ โ โโโ login/ # Login and welcome logic
โ โ โ โโโ hello/ # Basic Spring MVC examples
โ โ โ โโโ security/ # Spring Security configuration
โ โ โโโ resources/
โ โ โ โโโ META-INF/resources/WEB-INF/jsp/ # JSP views
โ โ โ โโโ application.properties # App config
โ โ โ โโโ data.sql # Initial data
โ โโโ test/ # Unit tests
โโโ pom.xml # Maven config
โโโ README.md # Project documentation
```
---
## ๐ฌ Contact
- Feel free to open an issue or submit a pull request if you find bugs or want to contribute improvements!
---