is it possible to use OSGI with spring boot microservices? Please tell me in detail

北城余情 提交于 2019-12-13 03:15:00

问题


I want to use ODL framework for SDN development, in that internally OSGI framework is used to (karaf). Apart from that i want to use spring boot and spring cloud to achieve cloud services also. It is possible to use these all framework as a single unit. and how we can achieve this please tell.


回答1:


This questions is somewhat overly broad and generic, but I'll try to answer it anyway making two assumptions:

If you want to use Spring Boot / Cloud "in-process", that is within ODL/ Karaf, then the answer to that would be that such an architecture would make little sense. Karaf (not ODL) has some Spring support as far as I know, but you'll probably have a hard time to marry that "nicely" with ODL...

The architecture of ODL is that you define YANG models and the RPCs you define in them "automagically" get exposed as HTTP REST APIs (via something called RESTCONF), and you can then consume those from other applications.

But if by your question you just mean if you can write a separate new Spring Boot / Cloud application and from that invoke OpenDaylight services via remote RESTCONF, then the answer is that this is certainly possible - and the recommended way to write integrations.

BTW: In this context, you may also be interested in https://lighty.io.

PS: You could have a look at https://github.com/vorburger/opendaylight-simple/ for some inspiration as well; but that is a POC which is not ready for consumption by you.




回答2:


It's possible to use Spring Boot in OSGI container. Please, see my answer on similar question: Can Spring Boot be used with OSGi ? If not, any plans to have an OSGi Spring Boot?

Here's a link to Spring Boot + Apache Karaf demo app: https://github.com/StasKolodyuk/osgi-spring-boot-demo



来源:https://stackoverflow.com/questions/52098061/is-it-possible-to-use-osgi-with-spring-boot-microservices-please-tell-me-in-det

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!