Spring MVC web application for borrowing and managing library books inventory.
This is my first Spring MVC project, which is an implementation of the library website. The application allow to borrow books (as a standard user), manage books inventory (add new ones, check availablity, etc.) and user account.
In Library Portal there are three types of users:
- Readers - they can register themselves and borrow limited number of books.
- Librarian - limited number of users that can add new books, borrow and return them. They can also confirm payments for penalties in case when a reader keeps a book to long.
- Admin - person, who can add, edit and deactivate users.
The application is written using Spring MVC framework and Gradle (for external dependency managment).
Database & configuration
- MySQL
- Flyway (for data migration)
- Gradle
- Tomcat
- Git
- Google Book API
Backend technologies
- Java
- Spring MVC, Spring AOP, Spring Security
- Hibernate ORM, Hibernate Validator, Hibenrate Search (Lucene)
- Retrofit, JSON
- JUnit
- Project Lombok
- Log4j2
Frontend technologies
- HTML, CSS, JavaScript
- JSP, JSTL
- Bootstrap 4
Prerequisites: Eclipse IDE (with Gradle and Tomcat plugin installed), Tomcat, MySQL Community Edition
- Clone this git repository
$ git clone https://github.com/wkrzywiec/Library-Spring
- Open MySQL Workbench and type following SQL script:
CREATE USER 'library-spring'@'localhost' IDENTIFIED BY 'library-spring';
GRANT ALL PRIVILEGES ON *.* TO 'library-spring'@'localhost';
SET GLOBAL EVENT_SCHEDULER = ON;
- Go to a folder
src/main/resources/properties
, create googleAPI.properties file and add your Google API key (here are instructions how to obtain it) as follows:
googleAPI.key=[YOUR KEY HERE]
-
Run
tomcatRun
Gradle task (or assign it to the Run button in Eclipse) -
The application will avaialble under URL
http://localhost:8080/library-spring
During work on this project I've parallely created some blog posts that describe my path to the working application. In those entires I've tried to explain some of key concepts, tools and frameworks that I used. Here is the list of all entries that was written so far:
Library Portal — Spring Project Overview
General
Configurations
Clean code
Features
Deployment
-
Deployment of Spring MVC app on a local Tomcat server for beginners
-
How to deploy web app and database in one click with Flyway (on Tomcat server)
Big picture on the database relationships.
Detailed look on user entity relationships.Some of them, like user_password_toke
are specific for Spring Security Forgot password feature.
And book entity relationships.
Finally user-book relationships, those tables stores book status information (like if it is reserved, borrowed, has penalties) or logs.
Login page
Main page, after login. The quote is taken from Random Quote API.
Admin can find and modify user profiles. Also there are possibility for him to see the logs of the user to check what changes were made on the user account.
Librarian can add new books to the library. New book data are fetched from Google Book API when search query is performed.
Every, regular user can register themself in the application.
After registration they can look for a book they want, see their details, and reserve it.
The librarian can borrow and return books. Also he can check book history to get the insight who and when make any action on a book.