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.
- π 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.
WelcomeController: Manages the welcome page and user session.TodoControllerJpa: Handles todo-related CRUD operations using JPA.SayHelloController: Demonstrates simple Spring MVC functionality.
TodoService: Contains business logic for managing todos (non-JPA implementation).
TodoRepository: Interface for data access using Spring Data JPA.
Todo: Represents the todo model with fields such asid,username,description,targetDate, anddone.
- Java 17 or higher
- Maven (or use the Maven Wrapper)
git clone <repository-url>
cd Todo-Web-Application-SpringBoot./mvnw clean install./mvnw spring-boot:run- Maven (or use the Maven Wrapper)
-
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.
-
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.
This application uses an H2 in-memory database for development and testing.
- H2 Console: http://localhost:8080/h2-console
- 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
# 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 testTodo-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
- Feel free to open an issue or submit a pull request if you find bugs or want to contribute improvements!