
Compare monolithic applications with microservices by highlighting a single-unit architecture, a single database, and dependencies in one configuration file, then explore independent services with own databases and load balancing.
Describe microservice architecture for a course enrollment app. Implement user and course services with create, read, update, and delete operations, security, and access through eureka discovery, zuul gateway, and Angular.
Set up server-side infrastructure by installing MySQL with background services, using HeidiSQL for database work, configuring IntelliJ with Java 8, and noting alternative Java versions.
Import and open a spring boot project in IntelliJ using start.spring.io, then configure java 8 in build.gradle and refresh dependencies as needed.
Install and configure lombok for the server side, enabling annotation processing to reduce boilerplate getter and setter methods.
Learn how Lombok auto-generates getters, setters, and constructors with class-level or field-level use. Explore @Data for equals and hash code, and @Value for immutable classes, plus no-args and all-args constructors.
Explore Spring core and dependency injection, highlighting constructor, setter, and field injection, and review key Spring annotations such as @Component, @Repository, @Service, @Controller, and @Transactional.
Design a user service architecture with CRUD operations and security using Spring Boot, MVC structure, REST controllers, Hibernate ORM on MySQL, Liquibase migrations, Lombok, and Gradle.
Create your microservice with spring initializer, a gradle java project using spring boot 2.1.6 and dependencies web, security, jpa, rest repositories, liquibase, mysql, eureka discovery, lombok, and import into IntelliJ.
Open and import the microservice in IntelliJ to begin development and set up the project.
Configure application properties to set the port, application name, and MySQL connection with UTC server timezone and automatic database creation, and configure liquibase with a changelog while disabling hibernate ddl-auto.
Explore how Hibernate maps Java objects to database tables using entity, table, column, id, and generatedvalue annotations, and manage entity relations with eager and lazy fetch strategies.
Create a User model in the model package, map to the user table with auto-increment id, include name, username, password, and a USER and ADMIN role enum, using Lombok @Data.
Discover how liquibase acts as a sql migration library for relational databases like mysql, mssql, and oracle, using xml, json, or sql changesets within a database changelog, with rollback.
Master basic sql queries for relational databases, including creating databases and tables, inserting, deleting, truncating rows, and performing select queries with where conditions.
Create a liquibase changeset for the user table using sql format in an xml databaseChangeLog, wire it into the master changelog, and enable rollback for runtime execution.
Understand how Spring Boot auto configuration enables JPA repositories for CRUD, extend with an entity and id, and use findById, save, findAll, plus query and modifying annotations.
Create a user repository by extending JpaRepository with User and Long, enabling standard CRUD operations and custom queries like findByUsername and findByIdList via hql.
Create a Spring Boot user service with an interface and implementation, autowire the user repository, encode passwords with PasswordEncoder, and implement saveUser, findByUsername, and findUsers by id list.
Explore rest controllers in Spring Boot, handling get, post, put, delete, and patch mappings and parameters via request body, path variable, and request param, with responses delivered through ResponseEntity.
Implement a Spring user controller with @RestController, inject UserService, and expose registration, login, and names endpoints using ResponseEntity, with conflict handling for duplicate usernames and a default user role.
Learn how Spring Security enables secure login via an encrypted authentication header, uses UserDetailsService to verify credentials, and defines login logout paths and access rules for rest api paths.
Explore the authentication module of Spring Security, starting with http filters and basic authentication tokens. See how ProviderManager delegates to DAOAuthenticationProvider and uses a user details service to secure context.
Implement a custom Spring security user details service by creating UserDetailsServiceImpl that overrides loadUserByUsername. Fetch users from userRepository, throw UsernameNotFoundException if missing, return security user with username, password, and authorities.
Explore spring security default configurations and customization, including login path /login, http basic, csrf, sessions, and logout, plus public and role-based urls and cors.
Configure Spring web security with WebSecurityConfig to enable CORS, permit resources, error, and service paths, authenticate the rest, and set up a UserDetailsService with bcrypt while disabling CSRF.
Configure application.properties to set the port, set registerWithEureka to false, enable eureka.client.fetchRegistry: true, and enable the Eureka server in the main class so other services can connect.
Build and run the system, mastering the setup and operation of a Eureka server to enable microservices communication with Spring Cloud.
Enable a Eureka client in the user service to register with the Eureka server, discover other services, configure zone and instance features, manage leases, and support load balancing.
Explore Eureka discovery with DiscoveryClient by listing discoverable services and instances, exposing endpoints for services, port, and instances, and testing by redeploying the user microservice.
Run the Eureka server by executing the main class, then start the user service and access it from a browser using its port; login redirects occur due to Spring authentication.
Explore crew service architecture and overview service within a microservices framework. Implement mvc structure with model, repository, controller and hibernate orm, including lombok for dependencies.
Create a microservice project with Spring Initializer, selecting project metadata, language, and Spring Boot version 2.1.6. Add dependencies for persistence and REST API, plus database migration and inter-service communication.
Configure application properties for the cool service by naming the app, setting the port, and specifying database name and credentials, plus liquibase changelog master and hibernate ddl auto.
Create a new model class in a model package as a database entity, define id (auto incremented), orders, category, and published fields, and implement equals and hashCode methods.
Develop a transaction model class as an entity with an auto-generated id, a many-to-one relationship to users, and an issue date using data annotations.
Liquibase constructs a database change log from change sets with unique identifiers for model class changes, including rollbacks for the stable and transaction tables and future test data.
Implement Liquibase test data for clues table, create a new team set, write search queries, and integrate change log templates into the master change log.
Create a reports package and implement the transaction repository by extending the GPA repository, with queries like find all by user IP and find by course.
Develop a Spring-based course service by creating a service interface and implementation, annotating with @Service, and wiring the crews repository and transaction repository to expose retrieval and transaction methods.
Connect to the user service using a thin client in Spring Cloud by wiring a user client interface, enabling thin client, and invoking user names from a controller.
Implement a course controller using dependency injection and autowiring, with api methods to get user transactions and to retrieve all courses via get mappings.
Create a unique client for the course service, configure local zone and instance with lease and expiry settings, and enable a Eureka discovery client to list all service instances.
Define allowed origins for cross origin resource sharing using a configuration class, override the add mappings method in an MVC configuration to permit all origins for testing.
Run and test the course service by starting your local server and the user service, then access the endpoints from a browser using the assigned ports.
Install a gateway microservice using Spring Cloud Netflix Zuul to route all microservices through one gateway. Include Zuul and discovery in a Java Spring Boot project (2.1.6) for local routing.
Configure service properties by setting the application name, port, and headers. Route requests through API prefixes via the gateway, pass logging and authorization headers to microservices, and enable discoverable services.
Configure timeouts in a microservices setup by setting properties, enabling eager loading for services, and adjusting default connection and lead time out durations.
Define a configuration class to enable cross-origin resource sharing by overriding the add mappings method, allowing all origins for testing, and enable gateway proxy to redirect other services.
Reach microservices through the zoo gateway by configuring localhost:8765 and the API prefix /api, using routes like /api/users to access specific REST endpoints.
Start and test the Zuul gateway service, then run the dependent microservices in dependency order, including the user service.
Demonstrates load balancing for the user service by launching multiple instances on different ports, configuring run environments, and verifying port distribution as requests refresh.
Prepare the client-side infrastructure by installing Node.js (version > 12), the Angular command line interface via npm, and Visual Studio Code.
Explore Angular basics with the command line interface, ng new project creation, and npm-based library management. Discover components, directives, services, pipes, guards, and lifecycle hooks such as ngOnChanges and ngOnInit.
Build a client-side UI for microservices, consuming data via API calls to support login, registration, profile, course listing, enrollment, and course details.
Install and scaffold an Angular 8 client app with the Angular CLI, Bootstrap, and essential components—login, register, profile, course, and home pages—plus user and core services to consume microservices.
Configure the Angular project with bootstrap and security; publish settings, organize secrets in json, create an icons folder, and integrate HDTV module with HDTV client module for API calls.
Implement model, service, and controller in Angular following the MVC structure. Describe building model classes and using services to call controllers via post and get requests to the HDTV API.
Define and configure angular routers for an app, mapping default, login, register, profile, and detail pages, and pass parameters via routes.
Create a user model class on the client side in Angular, defining user fields and a role field within a model package for reuse across microservices.
Develop a base model class for courses and transactions in the model package, define key fields with defaults, and implement a lowercase naming approach before extending to the transaction model.
Implement a user service in angular, calling REST API endpoints for get, post, login, logout, and register, maintaining current user via a behavior subject and local storage, secured through gateway.
Implement a login page in angular 8 by binding a user model to login form and calling user and authentication services, then navigate to profile page after a session check.
Implement the register page in Angular 8, wiring the user service, user model, and router, checking session, subscribing to the register method, and redirecting to the profile or login page.
implement the core course service in the service package, wiring post and get REST API calls for transactions, users, and courses, with an HDTV client and observable methods.
Implement the angular 8 user profile component to display current user details and their courses in a table, with routing for login and logout and data fetched via services.
Create a home page component in Angular 8 to list all courses in a bootstrap table, using core and user services and the router to navigate details with date pipe.
Implement the course detail page component, display a welcome message for the current course, and render a table listing all students by calling the course service with the route parameter.
Implement a navigation bar on the template page that toggles between login and register links and profile with current user name based on the user service observable.
Start the microservices in dependency order—eureka server, gateway-service, then user and course services—and test the client by running ng serve and opening localhost:4200.
In this course, we will learn microservices with using Spring Boot and Spring Cloud. To create it, we will implement eveything step by step from initial to finalize so everything will be so clear. Also, we try to look into every detail of code. Of course, we can miss some points of them but in that case, you know that all time you can ask your questions from Q&A section or from direct message. All questions and messages will be answered.
Our application goes on with two main components. These are server side and client side.
On server side, the main core thing will be Spring Boot and Spring Cloud. We will implement microservices with using these two libraries. Also, we will use these libraries on microservices;
First one is Spring Boot Web; Because we will use Model View Controller structure on our service.
Second one is Spring Security; Because we will implement secure login.
The other one is Java Persistence Api; Because we will use Object relational mapping.
The other one is Rest Repositories; Because we will use JPA and CRUD repository.
The other one is Liquibase; Because we will use it for database migration.
The other one is MySQL; Because we will use it for database.
The other one is Eureka Discovery; Because we will use it for communication with other services.
Last one is Lombok; Because we will use it for clean code.
On client side, we will use angular 8. We will create a course management sytem on front end. Also, we will implement it step by step.