Designing for modularity with Java modules
summary
Java 9 modules are used to enforce deliberate requires/exports/opens boundaries, with services implemented via the module descriptor and the JDK service loader to decouple front ends from multiple analyzer implementations; dependency injection (Juice example) works but needs open packages or a service-to-DI bridge. The EasyText sample demonstrates adding/removing provider jars without recompiling and loading plugins at runtime by creating separate module layers (new class loaders per layer) — it works and supports multiple versions per layer.
AI-written summary · about
chapters (24)
- 0:00Intro
- 2:15Today's journey
- 3:55Designing for Modularity with Java Modules
- 5:08A Module Primer
- 10:24EasyText example
- 13:41Reflection isn't a workaround
- 14:30Services to the rescue
- 15:20Providing a service
- 16:27Implementing a service
- 17:06Consuming a service
- 19:27Finding the right service
- 24:36Goal: Inject Instances using Guice
- 25:05Providing a Guice service
- 29:07Consuming a Guice service
- 30:15Injecting a service
- 30:42Downsides of this setup
- 31:05Services vs Guice
- 31:49Services and Guice
- 33:31Naming Modules
- 35:36API Modules
- 37:24Small Modules vs. All-in-one
- 42:41Breaking cycles: abstraction
- 44:15Optional dependencies
- 50:32ModuleLayer Demo
