Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从 Spring-DM 获取 OSGI 服务?
比如,Spring Bean.. ApplicationContext.getBean(id)...
使用 xml 注入它,如下所示
<osgi:reference id="contactDAOService" interface="com.javaworld.sample.osgi.spring.contact.ContactDAO"/>
然后您甚至可以从应用程序上下文中获取它。最好将其注入另一个 bean。