Amazon Web Services offers a way to connect to a MySQL or PostgreSQL database without having a password, instead an authentication token can be used.
Within AWS this type of authentication is called RDS IAM.
Users don’t need to store an username and password and credentials don’t need to be stored in the database, which makes this a secure authentication method.
So, this makes it interesting to use this in your Spring Boot application.
Spring Boot will use a HikariCP connection pool by default, but HikariCP 4.0.3 doesn’t support the use of authentication tokens.
So, how do I make this work within my Spring Boot application?
-
Enable RDS IAM for your database
-
Create a custom Hikari DataSource
-
Update application properties
Continue reading →
A while ago I was working on a Spring REST project and had a special wish. I wanted for one endpoint an exception thrown when someone requested it with an object with unknown properties. All the other endpoints with their rest objects should continue to exhibit the same behaviour. Let me share how I did this.
Continue reading →
Spring boot supports a non-blocking programming model with the spring-webflux module.
Webflux supports a Reactive API using the Reactor library Flux and Mono API types.
This model forces you to write your code in a different style than most people are used to.
It generally is much harder to follow and debug.
This post shows you a short example of using Kotlin’s Coroutines instead of Reactor to write your code in a more imperative and easier to follow style.
It includes examples of using Retrofit as HTTP client to access external API’s concurrently in a non-blocking way.
Continue reading →