Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 517479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:50:18+00:00 2026-05-13T07:50:18+00:00

Being someone who is allergic to dependencies, when would I use something like OSGi

  • 0

Being someone who is allergic to dependencies, when would I use something like OSGi instead of the built in java 6 http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html (I want to let plugin jars just be dropped in).

(FYI this is in a scala app, open to any suggestions, ServiceLoader is pretty damn close to what I want).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:50:18+00:00Added an answer on May 13, 2026 at 7:50 am

    If ServiceLoader mostly fits your needs, that says that you’re looking for service discovery via the presence of files on the class path. That’s only a small part of what OSGi provides.

    OSGi will let you dynamically install bundles, advertise services, revoke advertisements, and uninstall bundles all while the application is running. Furthermore, as a consumer of services, you can look them up eagerly — with filtering predicate queries — and detect when offered service providers come and go. These bundles need not lie on the class path, and they can be provided in various forms; Jar files and “exploded directories” are the two I recall.

    By contrast, ServiceLoader does just one thing: it exposes discoverable factories. Usually you’ll create a factory-style interface that takes some argument to decide whether that provider can offer the appropriate service, such as mapping a given character set name to a CharsetDecoder. There’s no formalized protocol for acquiring and releasing a service from such a provider. OSGi does formalize the binding and unbinding of consumers to services. The consumer can receive notification when new providers come online, and the provider can receive notification when a consumer acquires and releases a service instance. If this life-cycle control is important to your service and you forgo OSGi, you’ll have to build this yourself; ServiceLoader doesn’t go that far.

    Alternately, rather than eager service lookup and use, you can take a more passive, declarative approach and let one of the OSGi dependency managers match your stated needs to the available service providers. There are many dependency managers to choose from. Spring Dynamic Modules is one of the most capable.

    OSGi provides many other “middleware” facilities. I won’t try to sell you on them here, as your question focuses mostly on what you’d be missing out on by choosing ServiceLoader.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As someone who came from Java background and being a newbie to Ruby, I
Just starting to explore the 'wonders' of regex. Being someone who learns from trial
Can someone point me to an article that shows the dropdownlist being populated from
Can someone provide a good example of multiple UpdatePanels being updated by a singe
Can someone explain ProxyFactoryBean in simple terms? I see this being quoted lot of
It seems that every week or so someone posts a question about dates being
I am being an idiot, probably, but can someone help. I want to change
In the following jquery function, can someone explain to me why second is being
Being vaguely familiar with the Java world I was googling for a static analysis
Ok someone who happens to be a good friend of mine is sending me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.