Rest API Calling Using Feign Client Vs RestTemplate - spring

I want to call an API of the Spring Boot application from the my MVC Spring application. Is Feign Client or RestTemplate better for this API call and Why is it better?

Related

How to make Spring Data REST endpoints asynchronous?

Does anyone know how to make Spring Data REST endpoints asynchronous?
I saw that we can add the annotation #Async with CompletableFuture<?> as returned object on the service methods.
But doing this, makes the use of the interface RepositoryRestResource pointless as we need to implement both the service and controller layers manually...
Or am I missing something here?
Currently Spring Data REST supports blocking I/O only. See this Jira Issue of Spring Data REST support for Spring WebFlux.
Spring MVC has an integration with Servlet 3.0 async request processing.
Although Spring MVC has async support, for non-blocking I/O, Spring WebFlux is recommended, because Spring WebFlux is async by design. See Spring Web MVC Async Request Compared to WebFlux

Can we use resttemplate for consuming where the api is using jersey to produce

We are migrating our applications to Spring boot. One API is consuming the other API. The producing API is using jersey to produce the service. Can we use resttemplate for consuming the old API which is using jersey

Spring Reactor Web Client use case. replacing RestTemplate with WebClient

I am working on a microservice project where my individual spring boot microservices would be calling themselves and mainly to 3rd party API's to fetch and save data.
Since I am with legacy Spring boot application I can't think of replacing it with Reactor based Microservices.
But I am thinking of replacing My RestTemplate (using for communication with Other MS's and 3rd Party App) with new Spring Reactor Webclient to get some advantages of Async calls.
Is My use case a right candidate for Using Spring reactor WebClient?
Yes, composition of microservice and REST calls is a good use case for WebClient.
Plus Spring Boot 2 will let you combine the Spring MVC starter with the WebFlux starter and interpret that as "you want to run on the servlet stack, but might want to use WebClient sporadically".

Using Gateway to consume Spring Boot application from Spring Integration application

I am just starting with Spring Integration with Spring Boot 2.
I am working on a application which uses Spring Integration's HTTP outbound gateway to consume a Spring boot Service.
I am consuming the spring boot service from Spring Integration application using Gateway.
When I call the Gateway method which in turn will use the outbound gateway to call the spring boot service, the request does not seem to be completed. It is just going on when I make the HTTP GET request via the browser.
The request is also not received by the Spring Boot service.
I am not able to identify what is wrong in my Integration application when using gateway to consume a Spring Boot 2 service.
I have shared my Spring Boot 2 Application and also the Integration application which I am using to consume it in the below github folder. it contains 2 folders, one for the spring Integration application and the other for the spring boot application.
https://github.com/gsamartian/spring-int-demos
I have exposed a REST interface for the Integration application using RestController.
I access the boot application from integration application via the url, http://localhost:8763/callExternalServiceViaGateway
I am able to access the spring boot application directly from its port.
If anyone can help me identify the cause it would be great.
Thanks,
Your problem that the gateway method is without any args:
#Gateway(requestChannel = "get.request.channel", replyChannel = "reply.channel")
String getCustomMessage();
In this case the gateway works as receiving. No any requests is send because nothing to wrap to the payload. See more info on the matter in the Reference Manual.
Right now I see several bugs with the payloadExpression and no arg, so I suggest you to add some String payload arg to the getCustomMessage() gateway method and perform it with an empty string.
Will take a look into the bugs and will fix them soon.
Thank you for a good sample how to catch and reproduce!
https://jira.spring.io/browse/INT-4448
https://jira.spring.io/browse/INT-4449

Application publishing both REST and SOAP API with Spring Boot

I Have a Spring Boot application with RestController, service, and domain. So my application publishes a REST API. How would I go about to have my application publish both a REST and a SOAP API at the same time? Thanks!

Resources