This is a simulation project showcasing a simple registration, login, CRUD mechanism system, PayPal Payment Integration, Session Management, Thymeleaf, and Hibernate. The application uses Spring Security for authentication and authorization and connects to a MySQL database using Spring Data JPA and Hibernate.
The project uses the following main dependencies:
- Spring Boot Starter Data JPA: Provides Spring Data JPA, Hibernate, JPA API, JPA Implementation (default is Hibernate), JDBC, and other needed libraries.
- Spring Boot Starter Security: It is a powerful and customizable authentication and access-control framework. It is the de-facto standard for securing Spring-based applications.
- Spring Boot Starter Thymeleaf: It is a modern server-side Java template engine for both web and standalone environments. Thymeleaf's main goal is to bring elegant natural templates to your development workflow.
- Thymeleaf Extras Springsecurity5: A Thymeleaf integration package for Spring Security 5.
- Spring Boot Starter Web: Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container.
- Spring Boot Devtools: Provides fast application restarts, LiveReload, and configurations for enhanced development experience.
- MySQL Connector Java: JDBC Type 4 driver for MySQL.
- Spring Boot Starter Test: Starter for testing Spring Boot applications with libraries including JUnit, Hamcrest, and Mockito.
- Bootstrap: It is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.
- Webjars Locator Core: It is used for client-side web libraries packaging into JAR (Java Archive) files.
- Spring Boot Starter JDBC: This starter provides the necessary dependencies for using JDBC with Spring Boot.
- Spring Session Core: The core module for Spring Session, which allows explicit session management in your Spring application.
- Spring Session JDBC: This module provides JDBC (Java Database Connectivity) support for Spring Session, allowing sessions to be stored and retrieved from a relational database.
- Rest Api Sdk: This is necessary to interact with PayPal's APIs in the project.
This application is designed to demonstrate a user registration, login, CRUD mechanism system using Spring Boot as the primary framework, PayPal Payment Integration to handle (transactions, process payments, and handle refunds among other functionalities), Spring Session and JDBC to manage user sessions in a database, Thymeleaf for the front-end templating, and Hibernate for the persistence layer. The data is stored in a MySQL database, and Spring Data JPA is used to simplify database operations.
Spring Boot is used to create stand-alone, production-grade applications with minimum setup and configurations. Thymeleaf, a modern server-side Java template engine, makes it possible to process HTML files in the application's context and use them to render dynamic content. Hibernate is a popular object-relational mapping tool for Java that simplifies database operations.
The application uses Spring Security to handle authentication and authorization. It offers form-based login functionality with support for handling user roles. This helps ensure that only authenticated users can access protected resources.
In terms of front-end design, Bootstrap is used to style the web pages. The project uses WebJars, a client-side web libraries packaging system.
For development, Spring Boot DevTools is used for automatic restart and live reload during development. This dependency provides an improved developer experience by providing fast application restarts, LiveReload, and configurations for enhanced development.
Lastly, the project uses the Spring Boot Starter Test dependency for unit testing and integration testing. This includes libraries such as JUnit, Hamcrest, and Mockito. Spring Security Test is used specifically for testing Spring Security.
These instructions will guide you on how to get the project up and running on your local machine.
- JDK 1.8
- Maven
- A running relational database compatible with JDBC (e.g., MySQL, PostgreSQL, Oracle)
- Docker (Recommended)
- Clone the repo
git clone https://github.com/fadhlillah2/registration-login-spring-boot-security-thymeleaf.git
- Navigate to the project directory (Execute your docker if exists)
cd registration-login-spring-boot-security-thymeleaf
if you have docker, just run this command after navigating to the project directory:
docker compose up --build
Finally, wait for the process till success and open your browser and visit http://localhost:8080
. But, if you don't have docker, continue the next steps below.
- Install Maven dependencies
mvn install
- Edit the
application.properties
file with your MySQL credentials
spring.datasource.url=jdbc:mysql://localhost:3306/mydb
spring.datasource.username=root
spring.datasource.password=yourpassword
- Run the Spring Boot application
mvn spring-boot:run
- Open your browser and visit
http://localhost:8080
After running the application, navigate to the registration page, create a new user and you can manage consumer data (CRUD). You can then log in with this user to access the home page. You can also interact with it via HTTP requests. The session data will be persisted in the database through Spring Session using JDBC.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Fadhlillah - fadhlillah949699@gmail.com
Project Link: (https://github.com/fadhlillah2/register-login-dockerization)
The application uses Spring Boot's built-in testing capabilities to provide unit and integration tests. You can run the tests by using the following command in the project directory:
mvn test
The application can be deployed on any platform that supports Java 8. You need to first package the application into a JAR file, then you can run this JAR file on the deployment platform.
To package the application, use the following command:
mvn package
This will create a JAR file in the target
directory. You can then move this JAR file to the deployment platform and run it using the following command:
java -jar target/registration-login-spring-boot-security-thymeleaf-0.0.1-SNAPSHOT.jar
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Fadhlillah - Initial work - fadhlillah2
See also the list of contributors who participated in this project.
If you encounter any issues or require further assistance, you can create an issue in the repository. Make sure to describe the issue and include any relevant details like error messages or screenshots to help understand the problem better.