Sachin Handiekar

Sachin Handiekar


August 2013
M T W T F S S
« Jan   Feb »
 1234
567891011
12131415161718
19202122232425
262728293031  

Categories


Injecting OSGi Service Registry in Spring Context

Sachin HandiekarSachin Handiekar

Introduction

In this example we will inject a OSGi service registry inside a Spring Context.

OSGi Service Registry

Let’s assume we got a Oracle datasource in our OSGi container with the following service description. (Please see this link)
Spring Configuration

1. Add the OSGi namespace in your Spring context.



2. Using the osgi:reference to get the datasource object.




Comments 1
  • panneer selvam
    Posted on

    panneer selvam panneer selvam

    Reply Author

    @Sachin: i have followed the above steps to inject osgi service jndi datasource to the jdbcTemplate, but i am getting the nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate] found for dependency. what could be the issue?

    my spring config is as below

    osgi:reference id="dataSource" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=jdbc/mydb)" />


Leave a Reply