Spring XD as a Rest Endpoint - spring-xd

Can we integrate Spring XD and Spring MVC, so that we can ingest/process data sent to the REST end point?
We have huge amounts of data collected in a Spring MVC app and are wondering if we could use Spring XD for this.

The http source is a stripped-down http server (based on netty); it is not a full Spring MVC server. For that, you would need a custom source with an embedded tomcat/jetty.
See Artem's comment on this answer for a suggestion about how to embed tomcat in a module.

Related

Is it possible to support both REST & SOAP APIs on a single spring boot application?

We have a spring boot application which exposes REST endpoints. There is a requirement to support SOAP endpoints in the same application.
Can someone help out on the below questions as there is very little to no documentation on this part,
Can spring boot support both REST & SOAP endpoints, on the same port ?
If yes to the above questions, any good documentation or sample project will be really helpful.
Is it advisable to have spring boot application configured in this manner ? If no, what are the cons ?

Spring Reactive WebSocket does not come up when spring-web is present

I have an existing spring web application that uses spring-boot-starter-web; I have been planning to introduce reactive into this application. For a new feature that I am working, I have pulled in spring reactive web socket, configured and coded as specified in the spring doc; but unfortunately it does not work (got 404).
I tried a sample application and that works perfectly.
I used this one as my sample application.
I found that the sample application comes up on Netty, not on Tomcat. So I added spring-boot-starter-web to it, got the server to start in Tomcat and got the same 404 as I got in my application.
I also added TomcatRequestUpgradeStrategy unsuccessfully.
should I assume that spring-web and spring-webflux conflict with each other and I should go back to the regular websocket? Please advise.
Spring said that if both spring web and spring webflux present in the classpath; spring web kicks in and reactive websocket won't come up.
More details here: https://github.com/spring-projects/spring-boot/issues/23236

Apache NiFi Spring Boot integration

Understand that Apache NiFi could integrate with Spring as shown in SpringOne Platform 2016 Replay: Spring with ApacheNiFi. NiFi uses SpringContextProcessor to load Spring XML application context.
Question: Could NiFi integrate with Spring Boot? Specifically, could NiFi processor flows to a processor which calls a Spring Boot app, and then flows back to a NiFi processor? If so, is there any sample to demonstrate it?
Note: This integration is NOT about NiFi calling a Spring Boot REST API as shown in Spring Boot 2.0 on ACID : Integrating REST Microservices with Apache NiFi.
Note: This integration is NOT about NiFi calling a Spring Boot REST API as shown in Spring Boot 2.0 on ACID : Integrating REST Microservices with Apache NiFi.
REST is the only integration pattern here between Spring Boot apps and NiFi. The processor your referenced is good for using Spring components, but Spring Boot itself is a full application framework and would take a significant amount of effort to integrate.
The Nifi flow could use the InvokeHTTP processor to call a REST API which is implemented as your spring boot application.
I think you should check this Processor. SpringContextProcessor.
SpringContextProcessor – allows integration of processes encapsulated
in Spring Application Context to run as NiFi processor by becoming a
runtime host for an instance of Spring Application Context.
There is a demo video. It's very helpful
Official Apache Nifi SpringContextProcessor Documentation

Converting Spring MVC to Spring Boot app. Is it feasible and worth it?

Also, any suggestions plz on how to start on this?
My Spring MVC application is only a backend service with no front end screen.
I need to connect to Database and OAuth service in the backend in my application.
Since there are many parts missing (from MVC to boot), I'd recommend to create an empty boot project and fill in the mvc parts in the proper place. I could also recommend to use the Jhipster for generating a full spring boot boilerplate!

Spring contract-first REST

I have a Spring web application - which doesn't use Spring-based GUI, but Wicket - and I would like to build contract-first REST services.
I already have a contract defined in Swagger and I generate model and API artifacts. Swagger codegen generates either Spring Boot artifacts, or Spring MVC ones.
My intention is to use ideally just a model, and maybe API (controllers) from this generated code. But up to my knowledge/research, there is no simple way to have just simple REST service without MVC/Boot boilerplate.
Therefore my questions are:
Is it possible to build lightweight Spring-based REST service, without having "heavy" dependency of full Spring MVC/Spring Boot?
If not, which approach is more lightweight? Spring Boot, or Spring MVC?
You are misinterpreting the Spring ecosystem.
Spring MVC is THE rest web and web service library within Spring portfolio.
The same way as Spring-WS is THE soap web service library.
They are very similar in architecture and style of use.
The fact that Spring MVC is bundled with Spring Framework does not change the situation.
Spring Boot does not bring any new REST offering. It is just a bootstrap mechanism to start Java web server with web app already deployed from a plain main() method. Therefore if you see "Building REST web services with Spring Boot", it just means that it is Spring MVC bootstrapped by Spring Boot.
Therefore, the question to what is more lightweight is straightforward: Spring MVC.
To answer the question #2:
The usage of Spring MVC is more lighweight, then usage of Spring Boot:
Size of the WAR archive:
6,1 MB for Spring MVC
9,2 MB for Spring Boot
Number of libraries in WAR archive:
12 for Spring MVC
28 for Spring Boot

Resources