YO
YOUHAD08/product-springboot-mvc-app
A Spring Boot MVC web application for managing products with secure login, product search, and CRUD functionality using Thymeleaf, Spring Security, and JPA.
๐ Product-Spring-MVC - Product Management Web App
A complete Spring Boot MVC application that allows users to manage products securely with authentication, using Spring Boot, Spring Security, Thymeleaf, and Spring Data JPA for database interactions.
๐ง Features
- โ User login with Spring Security
- ๐ View list of all products
- โ Add a new product (secured)
- ๐ Access control with role-based authorization
- ๐ผ๏ธ Responsive web UI using Thymeleaf templates
- ๐พ Persistent data storage via JPA (H2/MySQL/PostgreSQL adaptable)
๐ง Application Architecture
๐ ๏ธ Tech Stack
- Java 17+
- Spring Boot
- Spring MVC
- Spring Data JPA
- Spring Security
- Thymeleaf
- Maven
๐ Project Structure
product-spring-mcv/
โ
โโโ .idea/
โโโ .mvn/
โ
โโโ src/
โ โโโ main/
โ โ โโโ java/
โ โ โ โโโ ma.youhad.productspringmcv/
โ โ โ โโโ entities/
โ โ โ โ โโโ Product.java
โ โ โ โ โโโ ...
โ โ โ โโโ repository/
โ โ โ โ โโโ ProductRepository.java
โ โ โ โ โโโ ...
โ โ โ โโโ security/
โ โ โ โ โโโ SecurityConfig.java
โ โ โ โ โโโ ...
โ โ โ โโโ web/
โ โ โ โ โโโ ProductController.java
โ โ โ โ โโโ ProductSpringMcvApplication.java
โ โ โ โ โโโ ...
โ โ โ
โ โ โโโ resources/
โ โ โโโ static/
โ โ โโโ templates/
โ โ โโโ layout1.html
โ โ โโโ login.html
โ โ โโโ new-product.html
โ โ โโโ notAuthorized.html
โ โ โโโ products.html
โ โ
โ โโโ test/
โ
โโโ application.properties
โโโ target/
โโโ .gitattributes
โโโ .gitignore
โโโ HELP.md
โโโ mvnw
โโโ mvnw.cmd
โโโ pom.xml
โโโ README.md
๐ธ UI Preview
๐ Login Page
๐๏ธ Products List
โ Add / Update Product Page
๐ Product Search Feature
โ๏ธ Configuration (application.properties)
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.h2.console.enabled=true
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update ๐ Security Overview
- Spring Security is configured in SecurityConfig.java
- Basic login authentication
- Only authenticated users (ADMIN) can access protected routes like adding products
- Default user/password can be customized in config or initialized in code
๐ฆ Dependencies (from pom.xml)
- Spring Boot Starter Web
- Spring Boot Starter Thymeleaf
- Spring Boot Starter Data JPA
- Spring Boot Starter Security
- H2 Database (can be replaced with MySQL/PostgreSQL)
- Spring Boot DevTools
๐ Endpoints
| URL | Description | Access |
|---|---|---|
/login |
Login page | Public |
/products |
View product list | Authenticated |
/products/new |
Add new product | Authenticated |
/notAuthorized |
Shown when user lacks permission | Authenticated |
โ Future Improvements
- Add user registration and roles (admin/user)
- Upload product images
- Improve UI with Bootstrap
- Add pagination/search features
- Deploy to cloud (Heroku, AWS, etc.)
โ Author
YOUHAD AYOUB



