Run multiple APIs on separate ports in kotlin springboot application - spring

I'm building an application backend and want to run 5 separate APIs on 5 separate ports under a single application. I'm using Kotlin, Spring, and Spring boot with Gradle build. I'm not sure how to do this.
Note: I'd also appreciate some feedback on how I can explain my question better, as I'm new to the technology as well as the forum. Thanks!

Related

Does spring boot come in to picture only while creating the project?

I've been learning spring boot for a while and as per my understanding, we use spring boot only to create the project along with dependencies and embedded servers. It doesn't have much of a role while working on the project or after the project is created.
I mean, if i were to work on an enterprise application for a company, chances are that, there is already a project created using springboot and I don't have to really use spring boot anywhere while working on that project.
Is my understanding correct?
I've tired googling, but did not find a clear answer.
No. You may still need to use the following spring-boot features after creating a project :
Externalise the application properties
Test the application using testing utilities and annotations provided by spring-boot
Use its auto-configuration feature to quickly configure if you need to enhance your application with other library/framework afterwards.
Use its developer tool to make you have a better Dev experience (e.g automatic restart the app when code changes , hot-reload static content etc.)
Use Actuator to monitor your application health and gather metrics.
I mean, if i were to work on an enterprise application for a company, chances are that, there is already a project created using springboot and I don't have to really use spring boot anywhere while working on that project.
I think you can say pretty much the same about any framework out there. I can't agree with this statement in general.
Every framework (including spring boot) provides a set of features that you may opt to use or not to use in your project.
So yes, for each existing microservice you'll have a #SpringBootApplication class.
Also probably set of configurations / practices how to work with configurations.
You'll already have also spring beans on existing project.
However software constantly evolves (otherwise it doesn't make sense to hire programmers, you know).
So when you (as a new employee) need to create a new micro service then, congratulations, you're using Spring boot features.
Other day-to-day tasks include (just a couple of example out of the head):
Create Integration Tests (#SpringBootTest)
Define new configuration Properties
Use Actuator
Use Metrics + define new metrics
Reconfigure Logging
Writing Liquidbase/Flyway migrations
Integrate new set of beans (Configurations)
Use Autoconfigurations
and so on and so forth.
If you want to really understand what you're doing while implementing these tasks you should know how do relevant features provided by spring boot work.

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

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

What better way to combine (integrate) javaFX with spring for build desktop applications

What we understand is that javafx has its own thread to execute the application. While the spring framework was also the case. Then how best and safest way to combine it? Is the spring run on the start method belonging to javafx, or javafx that runs in the spring.
You can have a look at this repository using Spring Boot.
https://github.com/thomasdarimont/spring-labs/tree/master/spring-boot-javafx
But do you really need Spring ? there are many other frameworks dedicated to JavaFX and providing same features in a more convenient way.

Spring boot + Activiti explorer

Is it possible to integrate activiti explorer maven plugin with activiti Spring boot app?, so that we can make use of activit-explorer to view deployed process in activit-spring boot engine.
I know we can use rest-api over spring boot to query process engine, but I want to know if it is possible to run the explorer over spring boot by adding it as a maven plugin during deployment?Or can we tweak the activit-explorer.war somehow to point to spring-boot activiti engine?
activiti-explorer.war is standalone webapp by itself. I've write some guideline on how to manually to embed activiti-explorer to you own app. http://blog.canang.com.my/2016/05/12/embedding-activiti-explorer-to-your-application/
Most probably step 5 in my blog is your solution.
btw, there's reason why the name is 'default'. I can't recall it atm
I thought of answering my own question so that it will be useful for other developers with similar requirement. If you want to make an eco-system where activiti-rest, explorer and your custom end points co-exist, please refer this thread from activit forum. I have tried this and is working fine. link to thread
I would like to give my observation here. In order to avoid getting into pulling source and trying to build myself, I achieved partial success, by installing the activit-explorer as part of the usual standalone installation.Started the standalone activiti-explorer using Apache-Tomcat but I configured the database for Activiti as same as (MYSQL in my case) I used in my spring-boot application to hit the common ground.
But apparently the activiti version in my spring boot app was 5.19.0.0 and that for activiti-explorer was 5.22.0.0, which created some misalignment for spring boot application startup to fail. I am hopeful that with matching versions it might succeed. When I get some more time on me I will try and update. Since then may be someone can use this route.

What are the parts of the Spring framework that does work with Appengine

Right now, I have been facing so much issue running some parts of the Spring Framework, like I have no problems running my Appengine web app with Spring MVC however have so many issues running Spring Data on top of Appengine.
I wan't to know which part of the framework have been tested to work with Appengine (AE)?
Does Spring Security work with AE?
Does Spring Data work with AE?
I'm guessing that there is no planned support for these frameworks at all for AE. However, hopefully I'm wrong.
I would suggest looking here: https://code.google.com/p/googleappengine/wiki/WillItPlayInJava
Spring Security is listed as SEMI-COMPATIBLE.
As for Spring Security, it works great. You'll just have to enable sessions. And if you want to apply the SPring filter on static files, make sure to exclude them from the static resources in appengine-web.xml.
As for Spring Data, I've never tried it but you might be able to use the JPA and REST sub-projects at least.

Resources