4

I'm reading about microservices, and one point I come across repeatedly, is, in order to achieve full indepencency, it's a bad idea to share libraries among microservices. Examples are here and here.

But how do open source libraries fit into this image? Can I use Apache Commons or Guava? If I'm using Apache Commons Lang in multiple services, would that mean I create dependencies, opposing the aim of a microservices architecture to create independent services?

1
  • 8
    Sharing dependency is bad if that means that when you change that dependency, you have to update multiple services. If you use a general purpose library, it doesn't matter if one microservice uses version 1 and another uses version 2. Jun 21, 2018 at 12:47

1 Answer 1

9

It's about libraries created by you to share common functionality when you're trying to avoid rewriting the same code in your multiple microservices. It creates a situation where you have a (loose) dependency between the microservices through the shared library.

This can create problems such as needing to modify the shared library to satisfy a requirement for one microservice, whereas the other microservice will not expect this new functionality and may break.

It has nothing to do with using third party libraries in your microservices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.