0

I have a project based on spring boot, using microseroservis, eureka as services registration and zuul as proxy server. I have two services that one dependes thah other. Each services has own rest controller, service, serviceimpl and repository, like the traditional spring-boot application. The service1 depends of service2, the question is: How do I manage this dependency?. I have two approach:

  1. Inject service2 interface on service1
  2. Using ribbon load balancer and create a client for each service and use de client to consume the service2.

Which of two approach is the best way for do it? What are the pros and cons of each?

victorpacheco3107
  • 822
  • 3
  • 10
  • 32

1 Answers1

0
  1. approach.

Services should be independent, organizes around piece of business logic, and you should be able to deploy them independently.

... architectural style that structures an application as a collection of loosely coupled services

They should communicate with each other thru HTTP requests or events (you have Kafka event streams).