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

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.

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.

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

Related

I am developing a website I know bootstrap and learned spring I want to know what else can be done to make it better?

I want to know what spring dependencies should I use on my website to make the work easy and spring or spring boot which one is better. also, suggest some frontend technologies that I can use to make the website smart.
It's a very broad question. And it all depends on what features you want in your web site. Just listing few basic module to give you some hints.
Spring MVC - For web application with MVC Pattern
Spring Security - To secure your app
Spring ORM - If using any ORM tool like hibernate
You need to explore more on the basis of your need.
Spring Boot vs Spring:
You should use Spring Boot if you are starting new project. Spring Boot came to make development process easier when using Spring Framework. In Spring, developer had to write lots of code to configure beans and dependencies. Spring Boot automated this process so that you no longer do it by yourself but Spring Boot will take care of it. Plus it provides some extra tools (In built Web Server, in Memory DB, tool to monitor and manage Spring Boot App )
Try to create a simple web app in Spring and Spring Boot to understand the difference.
Front-end Technologies:
JavaScript based framework/lib like Angular,React,Vue etc. are the trend for front-end now a days. Again there are pros and cons of each of them. Hence you need to evaluate, what suits you better as per your requirement.

BPMN for spring boot 2

We have started new project on spring stack and using latest versions. But we have workflow requirement and I used activiti in past. But as I see there is no spring boot 2 support for activiti and camunda. Can anybody suggest which BPM is best that can be integrated with spring boot 2.
You will find a bunch of Spring Boot 2 starters in the Flowable github repo.
The documentation explains step-by-step how to create a BPM enabled Spring Boot application. There is also the blog post The road to Spring Boot 2.0 that the improved support for Flowable within Spring Boot as part of the Flowable 6.3.0 release.
You ask for suggestions on which BPM is best. Well, I cannot be objective since I am part of the Flowable Team, but I can say that our Spring Boot implementation is pretty neat:
All engines are supported (BPMN, CMMN, DMN), both embedded and exposing their respective REST APIs.
There is an automatic configuration of Spring Security to use the Flowable IDM engine (in case no other custom security is configured).
There is no "EE" version of the starter. Flowable provides Spring Boot 2 support 100% Open Source.
The Spring Actuator integration is quite powerful.
Did I mention Open Source? ;-)
In order to get the all engines you would need to use the flowable-spring-boot-starter(-rest) dependency. The (-rest) needs to be used if you want the Flowable REST APIs to be automatically configured.
There is also the option to run the BPMN, CMMN or DMN engines in standalone mode. For that you would need one of the following dependencies:
flowable-spring-boot-starter-process(-rest)
flowable-spring-boot-starter-cmmn(-rest)
flowable-spring-boot-starter-dmn(-rest)
So, compare for yourself, but for me, it's pretty clear and of course I am open to discussion.
The Activiti is working on Activiti Cloud fully based on Spring Boot 2 and Spring Cloud Finchley (targeting kubernetes deployments, but it can be used outside kubernetes if that is not your thing) if you are looking for a BPMN runtime for Cloud Native applications. We are working hard on releasing the first Beta1 release at the moment, and we will very welcome feedback about it. Hope this helps.
If you use the camunda-bpm-spring-boot-starter you can write self contained services running camunda process engine with spring boot 2.

Spring or Spring boot

As part of a new web application project, I'm planning to learn Spring. I started to read through the Spring framework reference. While I was googling, I came across Spring boot. What I understood is that spring boot helps to build application much faster than spring by reducing configuration. Now I'm little confused whether should I continue learning spring or jump to spring boot. My intention is to understand how spring works as a framework rather than a few features. So please let me know, as a beginner what should I do? First, learn Spring and then spring boot or vice-versa.
Update
Ok, I know it's a while since I asked this question. I kind of have an answer (personal one)
I started with Spring Boot and so far built one Spring Boot REST application. Yes, as others said, Spring Boot, helps you to get started quickly and being new to some language/technology, I would love to see a working module ASAP. So Spring boot helps you with that.
Later depending on your interest, you can start exploring in-depth how Spring boot does that magic.
So, in summary, go with Spring Boot and then deep dive to understand the underlying concept. Again this is my opinion.
Thanks, everyone for your inputs/suggestions.
If you want to develop web applications especially micro-services, I will recommend that you should learn Spring Boot first.
The first reason is that there are many resources and examples on
web, so you can easily find what you need.
The second reason is that Spring Framework (including Spring Boot) is
suitable for PaaS environment especially Pivotal. Therefore you can
rapidly deploy your applications without too much effort.
First of all, learn how Spring applications work.
Spring applications are based on the Object Relation Model. You need to understand the annotations and why we use them. Then you have to learn how Spring MVC works. Up to here, both Spring and Spring Boot are similar. Basically, Spring Boot is made so that a Spring-based application can be made very easily. Spring Boot is very good framework for the Web and other.
After learning the above things, then you can jump easily onto Spring Boot. However, if you jump directly to Spring Boot you will see there are many such things which are not described in the Spring Boot tutorials, since many of them expect that you have some prior knowledge of Spring.

How to integrate Spring AOP in CDI - any examples

I would implement a Spring aspect in a j2ee application, can someone post some tutorials?
I've just used Spring in web application but I've not idea how to invoke a cross cutting concern in CDI container.
Thanks in advance
Is there a special need for combining Spring and CDI? If not, I'd suggest to stick to standard Java EE as long as you can solve your problem with it and only if not, look for external components (and even then, you should first check the "sort-of-standard" CDI extensionf from the Apache Deltaspike project.
Cross-cutting concerns can be solved via pure CDI - check our for example the Java EE 7 tutorial about the topic.
Small note: Don't use J2EE anymore if not maintaining an ancient application.

Spring Integration (not Basic Spring) support for Drools

Do we have examples or out of box support to use Spring Integration(not Basic Spring) as opposed to Camel with Drools like in link here?
What I would looking for is a way to build/set-up Decision Tables
and be able to use Spring Integration framework already existing in my application.
I have read about Spring but what I am looking for is Integration Framework support - specifically Spring-Integration as opposed to Apache Camel
Any pointers for basic set-up appreciated.
I think would be better if I move my comment to the answer to close this question:
I'd say that you should use that Drools-Camel fusion and route the result to the Spring Integration MessageChannel http://camel.apache.org/springintegration.html. Spring Integration doesn't support directly Drools and there is no plans.
The main reason - "do not reinvent the wheel".
Since Drools lives in JBOSS very well and has that Camel integration, there is no reason to find alternative solution.
Right, it's not a position of Spring Integration developer, but we just don't want to start a new holy war "Camel VS Spring Integration" :-).

Resources