hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
190 stars 98 forks source link

Auto detection of REST services without registering those ecplicitly in BundleActivator class #154

Open madhugarimilla opened 8 years ago

madhugarimilla commented 8 years ago

I was able to expose my Rest api by following the examples provided in this project. Is it mandatory to register all my rest services with the bundle context inside Activator explicitly? is there a mechanism that automatically detects and publishes all these Rest resources just by the @Path annotations?

BryanHunt commented 8 years ago

There is no way to automatically detect JAX-RS annotations. This is by OSGi design. You must register your resources using the Activator as you are doing now. You can also register the resources using DS (declarative services). I find it much easier to use DS.

jmacauley commented 7 years ago

@madhugarimilla as @BryanHunt stated you do have to register your resources for them to be accessible for scanning. As @BryanHunt pointed out Declarative Services will simplify things for you. Look at the org.osgi.service.component.annotations.Component annotation.

doggy-dev commented 7 years ago

Another framework that can register services is blueprint. It has coule of advantages over DS. For example you can inject beans from the same bundle and thed do not have to be registered as a service for this.