In this chapter, we'll learn about yet another exciting new feature in Java modularity called services. Services offer an additional layer of indirection between modules when compared to direct dependencies, and we will see that they add extra flexibility to how we can get modules to work with each other. In this chapter, you will:
- Understand one of the limitations of module dependencies the way we have been doing things so far
- Understand what services are and how they solve this problem
- Learn how to create and expose services
- Learn how to consume services using the ServiceLoader API
Before we learn what services are, let's examine and understand the actual problem that they were created to solve. It's the problem of tight coupling between modules with direct dependencies, at least the way we've been hooking them up so far.
...