Java, Spring Boot Mini Project - Library Management System - Download
Hello everyone, Hope you are doing well. Here, we provide a Library Management System mini-project for beginners, it's free for download. Maybe you can build more on top of this project and create your own product, that's all about you. The source code download link is provided at the end of this post.
1. Benefit of this project
You could cover the following technologies and features by learning and debugging this mini project.
- Java 17
- Java Stream
- Java Lamda Expressions
- Java Records
- Functional programming
- Object-oriented programming
- var Keyword in Java
- Generics in Java
- Java Switch
- Spring boot 2.6.4
- Spring Security
- Thymeleaf template engine
- OpenCSV
- Spring Data JPA
- Server Side Pagination
- H2 Database
- Bootstrap
- HTML
- CSS and more...
2. Objective Of Spring Boot On Library Management System
The main objective of this project is to manage the details of the books, author, category, and publisher. Only Admin/Librarian will manage all these activities. Also, they can export the data in CSV file format.
3. Functionalities
- Admin Login and Logout with Spring security
- Admin has permission to add new books, update books, view books, and delete books.
- Admin has permission to add new authors, update authors, view authors, and delete authors.
- Admin has permission to add new publishers, update publishers, view publishers, and delete publishers.
- Admin has permission to add new categories, update categories, view categories, and delete categories.
- Admin has permission to export the data in CSV file format.
4. System Requirements
- JDK 17
- Eclipse or any other IDE.
5. Technologies Used
- JDK 17
- Spring Boot
- Thymeleaf
- Spring Security
- Spring MVC
- H2DB
- Maven
- OpenCSV
6. User Interface
Admin Login Interface
Add new books, update books, view books, delete books
Add new publishers, update publishers, view publishers, delete publishers
Add new categories, update categories, view categories, delete categories
7. Quick Overview Of The Technology Used
Java 17: Java programming language was originally developed by Sun Microsystems which was initiated by James Gosling and released in 1995 as the core component of Sun Microsystems' Java platform. The latest release of the Java Standard Edition is Java 17. With the advancement of Java and its widespread popularity, multiple configurations were built to suit various types of platforms.Java 17 LTS is the latest long-term support release for the Java SE platform. JDK 17 binaries are free to use in production and free to redistribute, at no cost, under the Oracle No-Fee Terms and Conditions.
Download the latest version of Java- click here
Basic features of Java:
- Easy to learn
- Object-Oriented
- Robust
- Platform Independent
- Secure
- Multithreading
- Architectural neutral
- High performance
Spring Boot: Spring Boot is a matured Java framework built on the top of Spring framework. Spring Boot has defaults for almost everything. However, it still lets us to chose what to configure. For Instance, If a certain configuration is provided, it will be used. However, If a configuration is not provided Spring will replace with default and proceed.
Basic features of Spring Boot:
- Faster development
- Easy to manage
- Autoconfiguration feature
- Production-ready
- Embedded container
- Version management
- Actuators
Thymeleaf: Thymeleaf is a server-side Java template engine for both web and standalone environments.
Spring Security: Spring Security is a framework that focuses on providing authentication and authorization mechanisms to Spring applications
H2 Database: H2 is a relational database management system written in Java. It can be embedded in Java applications or run in the client-server mode. It can be used also in-memory mode. Here we are using the H2 Database engine as in-memory mode.
Maven: The Maven is a powerful project management tool that is based on POM (project object model). A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details utilized by Maven to build the project. It contains default values for most projects. Some of the configurations that can be designated in the POM is the project dependencies, the plugins or goals that can be executed, the build profiles, and so on. Other information such as the project version, description, developers, mailing lists and such can withal be designated.
8. Spring Framework Annotations Used In This Project
@SpringBootApplication: The @SpringBootApplication annotation is a convenience annotation that combines the @EnableAutoConfiguration, @Configuration and the @ComponentScan annotations in a Spring Boot application. The @EnableAutoConfiguration annotation enables Spring Boot to auto-configure the application context. The @Configuration is annotated at the class level to indicate that a class declares one or more @Bean methods and may be processed by the Spring container to generate bean definitions and service requests for those beans at runtime. The @ComponentScan annotation is used with the @Configuration annotation to tell Spring the packages to scan for annotated components.
@Autowired: We can use Spring @Autowired annotation for spring bean autowiring. @Autowired annotation can be applied on variables and methods for autowiring byType. We can also use @Autowired annotation on constructor for constructor based spring autowiring.
@Bean: The @Bean annotation tells that a method produces a bean to be managed by the Spring container. It is a method-level annotation. During configuration (@Configuration), the method is executed and its return value is registered as a bean within a BeanFactory.
@Controller: The @Controller annotation has been part of the framework for a very long time.@Controller annotation designates that the annotated class is a controller. It is a specialization of @Controller and is autodetected through classpath scanning.
@RequestMapping: The @RequestMapping is used to map web requests onto specific handler classes and/or handler methods. @RequestMapping can be applied to the controller class as well as methods.
@Service: This is an alternative to @Component that specifies you intend to use the class as part of your service layer. However, it doesn’t actually implement anything differently than @Component.
@Repository: The @Repository annotation is used to indicate that the class provides the mechanism for storage, retrieval, search, update and delete operation on objects.
@EnableWebSecurity: @EnableWebSecurity is used for spring security java configuration. Add this annotation with @configuration on top of your security java class that extends WebSecurityConfigurerAdapter.
@Entity: The @Entity annotation specifies that the class is an entity and is mapped to a database table.
@Table: The @Table annotation specifies the name of the database table to be used for mapping.
@Id: The @Id annotation specifies the primary key of an entity
@GeneratedValue: The @GeneratedValue provides for the specification of generation strategies for the values of primary keys.
@Column: The @Column annotation is used to specify the mapped column for a persistent property or field. If no Column annotation is specified, the default value will be applied.
9. Download Source code - Local environment setup
Step1: Install JDK 17 - click here
Step2: Install eclipse - click here
Step3: Download/clone source code - click here
Step4: Install Apache Maven - click here
Step5: Execute the command - mvn clean install
Step6: Run the app as a Java application or execute mvn spring-boot:run
Step7: Access the app - http://localhost:9080/
Step8: Admin Login - user name <admin@admin.in> & password <Temp123>