Online learning platform. Programming language videos in Hindi. Java In Hindi Microservices in Hindi Angular In Hindi SpringBoot In Hindi Database In Hindi Android in Hindi
if we need to talk to the other microservices, we can no longer use localhost like we could when we ran them on the same host In consumer service _______________________________________________ @RestController public class ConsumerController { @GetMapping("/") public String welcome() { return "Welcome from consumer-2"; } @GetMapping("/cdata") public String getData() { RestTemplate rt=new RestTemplate(); String url = System.getenv("MICROSERVICE1_URL") + "/data"; System.out.println(url+" <======"); return rt.getForObject(url, String.class); } } ____________ @SpringBootApplication public class DockerComposeConsumerApplication { public static void main(String[] args) { SpringApplication.run(DockerComposeConsumerApplication.class, args); } } _____________ Dockerfile FROM openjdk:17 EXPOSE 8082 ADD /target/consumer.jar /consumer.jar ENV MICROSERVICE_NAME consumer ENV MICROSERVICE1_URL producer:8080 ENTRYPOINT [ "java","-jar","/consumer.jar" ] __________________________________________________________________________________________ PRODUCT SERVICE _____________________ @RestController public class ProducerController { @GetMapping("/") public String welcome() { return "Welcome from producer-2"; } @GetMapping("/data") public String getData() { return "This data is produced by PRODUCER"; } } _________________________________ @SpringBootApplication public class DockerComposeProducerApplication { public static void main(String[] args) { SpringApplication.run(DockerComposeProducerApplication.class, args); } } _____________________________________ Dockerfile FROM openjdk:17 EXPOSE 8081 ADD /target/producer.jar producer.jar ENV MICROSERVICE_NAME producer ENTRYPOINT [ "java","-jar","/producer.jar" ] ______________________ docker-compose.yml version: "3" services: consumer: image: employee-consumer container_name: employee-consumer-c ports: - "8082:8080" networks: - consumer-producer-net depends_on: - producer producer: image: employee-producer container_name: employee-consumer-p ports: - "8081:8080" networks: - consumer-producer-net networks: consumer-producer-net:
@shubhamsanaye3 ай бұрын
Why you have added spring boot 3 logo and in code you have used 1.8. Just waste of time
@akshayhande375910 ай бұрын
Do not add background music. Good video but you should show it by hit API from consumer service
@rohamj Жыл бұрын
couldn't handle the keygen music...
@mickeygrohmann3004 Жыл бұрын
😑 P R O M O S M
@pawankrishna8918 Жыл бұрын
when i do the same thing it is showing connection refused I/O error on GET request for "localhost:9002/departments/1": Connection refused] with root cause how to resolve this
Пікірлер
hay remove the bg music
background music doesn't help the video!
The background music is disturbing.
Thank you!
if we need to talk to the other microservices, we can no longer use localhost like we could when we ran them on the same host In consumer service _______________________________________________ @RestController public class ConsumerController { @GetMapping("/") public String welcome() { return "Welcome from consumer-2"; } @GetMapping("/cdata") public String getData() { RestTemplate rt=new RestTemplate(); String url = System.getenv("MICROSERVICE1_URL") + "/data"; System.out.println(url+" <======"); return rt.getForObject(url, String.class); } } ____________ @SpringBootApplication public class DockerComposeConsumerApplication { public static void main(String[] args) { SpringApplication.run(DockerComposeConsumerApplication.class, args); } } _____________ Dockerfile FROM openjdk:17 EXPOSE 8082 ADD /target/consumer.jar /consumer.jar ENV MICROSERVICE_NAME consumer ENV MICROSERVICE1_URL producer:8080 ENTRYPOINT [ "java","-jar","/consumer.jar" ] __________________________________________________________________________________________ PRODUCT SERVICE _____________________ @RestController public class ProducerController { @GetMapping("/") public String welcome() { return "Welcome from producer-2"; } @GetMapping("/data") public String getData() { return "This data is produced by PRODUCER"; } } _________________________________ @SpringBootApplication public class DockerComposeProducerApplication { public static void main(String[] args) { SpringApplication.run(DockerComposeProducerApplication.class, args); } } _____________________________________ Dockerfile FROM openjdk:17 EXPOSE 8081 ADD /target/producer.jar producer.jar ENV MICROSERVICE_NAME producer ENTRYPOINT [ "java","-jar","/producer.jar" ] ______________________ docker-compose.yml version: "3" services: consumer: image: employee-consumer container_name: employee-consumer-c ports: - "8082:8080" networks: - consumer-producer-net depends_on: - producer producer: image: employee-producer container_name: employee-consumer-p ports: - "8081:8080" networks: - consumer-producer-net networks: consumer-producer-net:
Why you have added spring boot 3 logo and in code you have used 1.8. Just waste of time
Do not add background music. Good video but you should show it by hit API from consumer service
couldn't handle the keygen music...
😑 P R O M O S M
when i do the same thing it is showing connection refused I/O error on GET request for "localhost:9002/departments/1": Connection refused] with root cause how to resolve this