Spring Boot Microservices Tutorial - Part 2 - Order Service
Vložit
- čas přidán 16. 07. 2024
- In this Spring Boot 3 Microservices tutorial series, we will learn how to build microservices using Spring Boot and Spring Cloud.
This is part 2 of the series, in this part, we will cover:
- Building Order Service
- Database migrations using Flyway
- Writing Integration Tests using Test Containers
Timestamp:
Generate Order Service - 00:00
Initialize Database using Docker Compose - 06:25
Build Submit Order Endpoint - 10:55
Database migrations using Flyway - 18:30
awesome video, learned a lot.
Many Many and Many Thanks for posting this playlist ! ☺
Thank you, brother
excited fo playlist
Please sir Font ko thoda Bigger rakhiye
Because of while we are working together with split screen there is a problem to read the text 😢😢
Hello, instead of we downloading the MySQL workbench to connect to local databases, we can use the built in database tool in IntelliJ right? It's in the same location where we run the maven commands. It allows us to connect to most of the available databases just by downloading the required drivers.
🙂🙂👍
Sir,are you releasing the course today?
Hi Sai, I'm facing some problem related to creating the order_service container, it's throwing this error:
\order-service>docker compose up -d
[+] Running 0/2
- Network order-service_default Created 0.2s
- Container mysql Starting 0.2s
Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:3306 -> 0.0.0.0:0: listen tcp 0.0.0.0:3306: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
Could you help me fix this error.
You might have an instance already running on this port. Therefore either close the instance that is running on the port or just change the port by changing the docker-compose.yml ports to -"3307:3306"
@@anotherOne12342 thank you
Why you don't use the dbname in docker-compose in feld MYSQL_DATABASE 2:15 and named there and save great new file? thx
Yes this is also an option, you can follow it.
Just a heads up for anyone doing this video. I am using the open source version of Intellij IDEA and am unable to create sql files. It just shows as a regular file so when I run OrderServiceApplication it doesn't migrate to version V1
I was able to bypass but making a script in mysql workbench to create t_orders table
CREATE TABLE order_service.t_orders (
id INT AUTO_INCREMENT PRIMARY KEY,
order_number VARCHAR(255) NOT NULL,
price DECIMAL(10, 2) NOT NULL,
quantity INT NOT NULL,
sku_code VARCHAR(255) NOT NULL
);
I had to remove the record in flyway_schema_history, and rerun the application with following sql:
CREATE TABLE order_service.t_orders (
id INT AUTO_INCREMENT not null PRIMARY KEY,
order_number VARCHAR(255) default null,
price DECIMAL(10, 2),
quantity INT,
sku_code VARCHAR(255)
);
Make it zoom in
My 'order-service' scheme is not being created. I deleted the mysql folder mentioned in volumes and tried again a couple of times.
I am experiencing a similar issue. did you manage to fix it ?
try to write the db name in double quote
+1, I tried but still having the issue. How to fix it?
Sir, Series poori hone m kitna time lgega. I am following along actually 6 din m pichla sara bhul gya
Aur 2 weeks lagega, poora episodes release hone ke bad dekho course. I can only release 2 videos per week.
Sir git link?
github.com/SaiUpadhyayula/spring-boot-microservices/tree/initial-setup
The source code will be updated for each part
Any one getting this error "Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Validate failed: Migrations have failed validation Detected failed migration to version 1 (init). Please remove any half-completed changes then run repair to fix the schema history." then drop flyway history table from your schema and then re run your program now everything will work fine
did you find a workaround??
@@Uttkarsh_8 follow these steps
1) Goto to workbench and drop the table named flyway_schema_history
2) Change the migration script to this
CREATE TABLE IF NOT EXISTS `t_orders` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`order_number` VARCHAR(255) DEFAULT NULL,
`sku_code` VARCHAR(255),
`price` DECIMAL(19,2),
`quantity` INT(11),
PRIMARY KEY (`id`)
);
now rerun the application.
if still any error is coming the change the mySql version 8.1.0 in docker-compose.yml file
i.e. image: mysql:8.1.0
if still problem is not solved then chhod do 🤣🤣🤣🤣🤣🤣