且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

可以将OSGI与Spring Boot微服务一起使用吗?请详细告诉我

更新时间:2022-01-13 17:16:02

这个问题有点过于广泛和笼统,但是无论如何我都会尝试做两个假设来回答它:

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

如果您想在ODL/Karaf中使用Spring Boot/Cloud"in-process",那么答案就是这样的架构毫无意义.据我所知,Karaf(不是ODL)对Spring有一些支持,但是您可能很难将它与ODL很好地"结合起来...

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...

ODL的体系结构是您定义YANG模型,并在其中定义的RPC自动地"作为HTTP REST API(通过称为RESTCONF的东西)公开,然后可以从其他应用程序中使用它们.

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.

但是,如果您的问题只是意味着您可以编写一个单独的新Spring Boot/Cloud应用程序,然后通过远程RESTCONF从该应用程序调用OpenDaylight服务,那么答案是肯定可以做到这一点-以及推荐的集成编写方式

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.

顺便说一句:在这种情况下,您可能还对 https://lighty.io 感兴趣.

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

PS:您可以看看 https://github.com/vorburger/opendaylight-简单/以获得一些启发;但这是一个POC,尚未准备好供您消费.

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.