Skip to content

aditya-620/Todo-Web-Application-SpringBoot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ 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

git clone <repository-url>
cd Todo-Web-Application-SpringBoot

2. Build the Project

./mvnw clean install

3. Run the Application

./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.


🧰 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

# 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!

About

πŸ“ 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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages