Monday, February 21, 2011

JAVA 6 ServiceLoader

I recently posted a question regarding a way to define the implementation of an abstract service on the client side.

dfa mentioned java.util.ServiceLoader as a solution for my problem.

I ended up going in a similar way, though not using ServiceLoader directly, mainly because i was using JDK 5. But another SOer jut went into panic when dfa mentioned ServiceLoader.

I am wondering what are the main problems with the ServiceLoader implementation. Though limited it seems a good way to solve this issue without going full out on some third party library like Guice

From stackoverflow
  • ServiceLoader is less general than a full dependency injection framework like Spring or Guice. It is designed to lazily load services, that can be deployed at run-time. Therefore ServiceLoader is especially useful for plugins.

    For a complete answer you must ask to Tom Hawtin Tackline.

    Nuno Furtado : My feelings exactly, this is the reason i posted this question. To understand, if any, the reasons behind the dislike of this feature

0 comments:

Post a Comment