Today I had a look at the ServiceLoader class in Java SE 6.
The ServiceLoader is a generic factory that can be configured with a simple file located in META-INF/services. The filename must be the full qualified name of the interface and contains a single line with the full qualified name of the implementation ch.simas.impl.MyServiceImpl.
The usage is also very simple:
for (Iterator
MyService myService = it.next();
}
Try it out!
03 April 2008
Java SE 6 ServiceLoader
Abonnieren
Kommentare zum Post (Atom)
0 Kommentare:
Kommentar veröffentlichen