Library-Spring icon indicating copy to clipboard operation
Library-Spring copied to clipboard

The library web application where you can borrow books. It's Spring MVC and Hibernate project.

Library Portal (in Spring)

Spring MVC web application for borrowing and managing library books inventory.

Description

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.

Tools & Frameworks

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

How to run it?

Prerequisites: Eclipse IDE (with Gradle and Tomcat plugin installed), Tomcat, MySQL Community Edition

  1. Clone this git repository

$ git clone https://github.com/wkrzywiec/Library-Spring

  1. 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;
  1. 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]

  1. Run tomcatRun Gradle task (or assign it to the Run button in Eclipse)

  2. The application will avaialble under URL http://localhost:8080/library-spring

Blog Posts

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

User Log Events
Full-text Search
User registration
Add book to library

Deployment

Database Diagram

Big picture on the database relationships. Database

Detailed look on user entity relationships.Some of them, like user_password_toke are specific for Spring Security Forgot password feature.

User database

And book entity relationships.

User database

Finally user-book relationships, those tables stores book status information (like if it is reserved, borrowed, has penalties) or logs.

User-Book database

Screenshots

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.