Home » Spring

Tag Archives: Spring

Add Grpc to your Spring Application

spring-interview-questions-answers

On the previous example we had a Java application spinning up an http server and upon this Java process operating a GRPC application. If you use frameworks like Spring you might wonder how you can achieve a Grpc and Spring integration.There are libraries out there that do so, we shall use the grpc-spring-boot-starter from io.github.lognet.We shall start with the dependencies. ...

Read More »

Executing Blocking calls on a Reactor based Application

spring-interview-questions-answers

Project Reactor is a fully non-blocking foundation with back-pressure support included. Although most libraries out there support asynchronous methods thus assist on its usage, there are some cases where a library contains complex blocking methods without an asynchronous implementation. Calling this methods inside a reactor stream would have bad results. Instead we need to make those method to async ones ...

Read More »

Receive Pub/Sub messages to your Spring Application

spring-interview-questions-answers

Pub/Sub is a messaging solution provided by GCP Before we dive into the actual configuration we need to be aware that Spring Cloud for GCP is now managed by the Google Cloud Team. Therefore the latest code can be found here. Our application will receive messages from Pub/Sub and expose them using an endpoint.Let’s go for the imports first <?xml ...

Read More »

Using R2DBC with a Reactor Application

spring-interview-questions-answers

Since Reactor has taken over the Java world it was inevitable the a reactive sql library would be there.In this blog we shall use r2dbc with h2 and reactor. We shall start with the dependencies needed. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.2</version> </parent> <groupId>com.gkatzioura</groupId> <artifactId>r2dbc-reactor</artifactId> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> ...

Read More »

Obtaining TLS Client Certificates In Spring Integration

java-interview-questions-answers

Spring Integration is a very powerful and extensible framework for, well, integrations. But sometimes it’s not trivial how to get some information that yo need. In my case – a certificate used for mutual authentication in a TLS (syslog over TLS) connection. You have a Java method that receives a Message and ideally you’d want to get the certificate chain ...

Read More »

Keeping track of requests and Responses on Spring WebFlux

spring-interview-questions-answers

In any rest-api based application it’s a matter of time when there is going to be the need to intercept the requests towards the application and execute more than one actions. If those actions, are actions that need to apply towards all requests to the application then the usage of filters makes sense, for example security. On Servlet based applications ...

Read More »

Coroutine based Spring boot webflux application

I have worked with Spring Framework for ages and it still manages to surprise me with how cutting edge it continues to be but at the same time enabling a developer to put together a fairly sane app. The most recent surprise was with how it enables programming a web application with Kotlin coroutines. Coroutines is a fairly complicated concept ...

Read More »

Upload files in Spring Boot application using Commons FileUpload

spring-interview-questions-answers

In our previous post, we saw how to upload a file using the Spring framework’s default implementation for MultipartFile interface. In this post, we will see how we can use the Commons FileUpload library and the wrapper implementation CommonsMultipartFile provided by the Spring framework. Update the pom.xml We will update the maven dependencies to include commons-io and commons-fileupload. We will ...

Read More »