serviceloader

A collection of 2 posts

A Java geek
  • Me
  • Books
  • Speaking
  • Mentions
  • Focus
Oct 13, 2019 serviceloader module

Migrating the ServiceLoader to the Java 9 module system

A long long (long?) time ago, I wrote a post about the ServiceLoader. In short, the Service Loader allows to separate an API and its implementations in different JARs. The client code depends on the API only, while at runtime, the implementation(s) that is (are) on the classpath will be used. This is great way to decouple the client code from the implementing one. For example, the ServiceLoader is used by SLF4J: one adds the slf4j-api on the classpath at compilation time, while any single impl

Nicolas Fränkel
Mar 20, 2009 decoupling dependency dependency injection di meta-inf osgi service locator serviceloader services

Simplest Java decoupling without 3rd party frameworks

[…​] coupling (or dependency) is the degree to which each program module relies on each one of the other modules. — Wikipedia http://en.wikipedia.org/wiki/Coupling_(computer_science) In object-oriented programming, removing dependencies is done by using interface. Thus, if class A is dependent on class B, we introduce interface C, which is implemented by B. Now A depends on C  (see below). This first step in decoupling is called programming by interface. Anyway, we sti

Nicolas Fränkel
A Java geek © 2008-2025
v. 3e41a62fce7059edee3a627a38608c8ed0d7a885/12538667525
Latest Posts