This post originated from an RSS feed registered with Java Buzz
by Marc Logemann.
Original Post: What i am missing from the Jar Service Provider spec
Feed Title: Logemann Blog
Feed URL: http://www.logemann.org/blojsom/blog/default/?flavor=rss2
Feed Description: Marc's thoughts on Java and more
I am about to create plugins that should be discovered during runtime by our application. The user can then chose the plugin (meaning the class implementing a specific interface here) he wants to use. So far this is an easy task, see here how to do it the sun way. Now there is one thing that is annoying. Our application is a web application and as long as the plugins are in WEB-INF/lib, everything is fine. But i also want to have some plugins right inside WEB-INF/classes, so i thought i could just add the needed definition file under META-INF/services of the WAR file. But this is not working at all.
To get it running it seems i need to refactor out the plugin classes from WEB-INF/classes of my WAR into a seperate JAR (with the needed META-INF stuff inside the JAR) which i will place in WEB-INF/lib then. It would be so more convenient to do it the way i wanna do it. All in all this whole plugin idea could be enhanced so much more, i think sun has not overperformed in that area. Take alone the package name of the needed Service class which is sun.misc.Service. Not very cross-jdk as you can see.