
Architect a full-stack online product seller with Spring Boot and React, implementing user and product CRUD operations, JWT security, and role-based authorization across server and client.
Build a full stack online store with Spring Boot and React, featuring login, home page product browsing, an admin dashboard, role-based access, purchases, and profile details via REST endpoints.
Explain why Java 11 is chosen as the long-term support version. Show downloading the RGA installation file from Oracle and installing it with default settings after signing in.
Choose Intellij for Java full stack development, benefiting from a faster learning curve, strong code completion, and quick project results, then download the community version and install with default settings.
Download mysql from the community server downloads page for your operating system, then install it and set up the root credentials for future operations.
Install Lombok in IntelliJ (pre 2021) and enable annotation processing in settings to avoid boilerplate getter and setter methods for server-side code.
Download and install Postman to test APIs. Create API endpoints in your project and test them with Postman, using all request methods and authorization headers after registration.
Explore Spring dependency injection to build loosely coupled applications, using constructor, setter, and field injection with beans, repositories, and services, guided by configuration and common Spring annotations.
Learn a rest api overview with http methods, including get, post, put, and patch mappings, request handling, parameters, payloads, and response entities.
Learn SQL basics for relational databases, including creating databases and tables, and defining primary keys. Practice create, read, update, and delete operations with insert, select, and delete statements.
Explore Lombok, a library that automates getters, setters, and constructors. See how data annotation generates getters, setters, equals, and hashCode, and how no-args and all-args constructors enable immutable classes.
Install Postman to build, test, modify APIs. Use it to send HTTP requests, set JSON bodies and headers, save APIs, and convert API calls to code in languages, including authorization.
Learn how the @RequestParam annotation in Spring extracts query and form parameters, optionally using a custom name, setting required to false, and providing a defaultValue for missing params.
Learn how the PathVariable annotation in Spring maps URI template variables to method parameters. Customize the variable name and mark it optional with required = false.
Learn how the @RequestBody annotation maps the HTTP request body to a domain object using Spring's HTTP message converters, handling content types like JSON with optional Jackson support.
Explore backend architecture with database, core backend, and frontend, and build a product service with CRUD and sign up and sign in using spring boot, jwt, jpa, hibernate, and mysql.
Create a Spring Boot project with Spring Initializr, choosing Maven or Gradle and the latest stable version. Add dependencies such as Web, Security, JPA, and Lombok, then import into IntelliJ.
Create a MySQL database and add a user with a secure password in MySQL Workbench, then review privileges; the database will be auto-created via configurations in the next lesson.
Configure database properties in application properties for a Spring Boot project, including datasource url and credentials. Enable UTC time zone and public key retrieval for sha-256 passwords with Hibernate.
Outline the core data model for an online shopping app with users, products, and purchases. Admin roles manage products, while purchases record user, product, price, and date.
Create a Java persistence entity named user mapped to the users table with an auto id and fields username, password, name, and role (enum), using Lombok for getters and setters.
Learn about id generation strategies in Hibernate and JPA, including default, identity, sequence, and table generator, with practical examples, repositories, and testing.
Create product model as a JPA entity with identity generated id, name, description, price, and create date fields, plus a logging time. Use Lombok to auto generate getters and setters.
Explore how Hibernate maps Java objects to database tables using entity, table, and color annotations, and model one-to-many, many-to-one, and many-to-many relationships.
Create a purchase entity linking user and product, with id, price, and purchase time, using many-to-one joins, lazy loading, and Lombok-generated getters and setters.
Implement a user repository using Spring Data JPA by extending JpaRepository, enabling automatic CRUD operations and custom queries with @Query and @Param, including find by username.
Create a product repository interface by extending JpaRepository<Product, Long>, enabling automatic CRUD operations and query methods like findByName and findByPriceGreater.
Create a purchase repository with Spring Data JPA, extending JpaRepository, and define a purchase item projection to fetch user purchases with product names via a left join.
Build the user service in the business layer, wire it to the user repository, and implement save, find, and change user role operations with a password encoder.
Develop the product service as the business logic layer, wiring it to the product repository via dependency injection and implementing save, lead by id, and find all methods.
Implement a purchase service in the business layer using a service interface and implementation, wiring with the purchase repository to handle save and find operations.
Learn how spring security authenticates requests with the basic authentication filter, authorization header, and base64 credentials, loading user details from the database and applying authentication providers.
Explore Spring Security authorization architecture, including interceptors, access decision managers, and voters that grant or deny access to secured resources via role, authenticated, and remember me checks.
Explore how spring security handles authentication and authorization, from secure login with encrypted headers to user details service validation and access control for login and home pages.
Explore Spring Security fundamentals by implementing a custom user details service to load users by username, convert roles to authorities, and secure requests with JWT-driven authentication.
Configure a custom web security setup with authentication manager, http security, and JWT-based stateless authorization, including CORS, CSRF disabled, and login/register endpoints in Spring Security.
Diagnose a bean cycle that triggers a circular reference error in Spring Boot 2.6+. Fix it by enabling circular references in application properties after aligning security config and user services.
install and configure JWT libraries for authorization after authentication. add maven dependencies for JWT and Jackson, and set a 512-bit secret with HS256 and one-day expiration.
Implement a jwt provider to generate, authenticate, and validate tokens, with username and expiration claims, and extract bearer tokens from authorization headers for Spring Security.
Implement a custom jwt authorization filter that creates and validates tokens from http requests, and sets the authenticated user in the security context for the request lifecycle within spring security.
Implement sign-in using the authentication manager and Spring Security to convert user credentials into a user principal, generate a JWT token, and return it with the user object.
Learn to build Spring REST API methods in a RestController using ResponseEntity with headers and status; handle post, put, and delete mappings for form data and path or query parameters.
Create a Spring authentication controller that maps sign up and sign in endpoints, enforces unique usernames, saves users via the service, and returns a JWT.
Implement a rest controller for user management, injecting the user service to expose an API endpoint that changes a user's role via authentication principal, using jwt tokens for authorization.
Implement a Java REST controller for product management, exposing create, list, and delete endpoints under /api/product, secured by JWT with admin-only access for changes. Test endpoints with Postman.
Create a rest purchase controller mapped to /api/purchase, saving purchases via the purchase service and listing user purchases using the authenticated user from the authentication principal with JWT.
In this course, we will create a new project like an online-product-seller.
When I say online-product-seller application, we can think of it like that we will have a product-list page. Somehow users or customers will see these product-lists and they can buy one of them. Of course, at the end of it, this purchase will be stored and displayed later.
And we will implement this project using Spring Boot, ReactJS, and MySQL.
In our project, we will implement CRUD operations. These CRUD operations will be for users and products. We will use users for user sign-in, sign-up and authorization operations. And we will use the products for creating, editing, and deleting product operations.
These CRUD operations will be requested from ReactJS. So on the backend, we will create an infrastructure for these CRUD operations and on the frontend, we will serve them with the user interface.
Our project goes on with User and product operations.
Our main operations will be user login, register, product-list, create-product, delete-product etc.
Also, we will go on with the role based application. So we will use different roles like “Admin”, “User”. Then we will provide different authorizations to these users according to the role.
And this all things will be provided with a secure way in both React and Spring Boot.
We will have two main components to implement our project.
These are server side and client side.
In Server Side:
Of course here, our main library will be Spring-boot. We will implement the whole infrastructure on the backend with the Spring boot. It will provide easy and fast configuration to us.
We will implement the Model view controller architecture on our project.
Spring-security will be one of the main topics in our application. Also, we will use JWT to provide security.
In Spring Boot, Data will be presented to the client as an API call so Spring Rest Controller will be used to handle it.
We will use MySQL as Database. We can use other databases also but most of us familiar with MySQL.
We will also use Object Relational Mapping with Java Persistence API and Hibernate.
You know, We can map our database tables to objects with hibernate.
We will use JPA Repository and Crud Repository in Spring Boot.
So these repository templates will handle common database operations like save, update, find, delete.
With Spring Boot, we will also use the Lombok library to clear code.
You know that we don't want to implement getter, setter, equals and hashcode. So we can escape it using Lombok @Data or @Value annotation.
We will use Maven To handle all dependencies on the server side. Actually, here we can also use Gradle. Gradle provides better performance than maven but Maven is the most common one. So we'll go on with maven.
That's all about Server side.
Let's talk about Client Side.
We will create a ReactJS application on the client side and it will provide a cool user-interface. So we will create some pages like home-page, admin dashboard, login page and register-page. Then we will assign the server apis to these pages and we will consume and produce the data from the user-interface easily and user friendly.
Last but not least, we will implement security and authorization on ReactJS also. We will work with different roles and according to these roles, we will implement unauthorized and not-found pages on the user interface also.
We will see the details of them one by one.