Keycloak server embedded in a Spring Boot application with custom User Storage SPI


I have managed to set up a Keycloak server embedded in a Spring Boot Application successfully, following this tutorial: Keycloak Embedded in a Spring Boot Application in order to avoid setting it up manually.

Since I am dealing with an old implementation that already has it’s own DB, I decided to use Keycloak’s User Storage SPI to connect to an external postgresql DB and use this for authentication instead of Keycloak DB.

To do this, I followed the tutorial on Keycloak documentation, but it envolves a standalone Keycloak server, creating a .jar with the custom provider and injecting it to <pathToKeycloak>/standalone/deployments/ .

I have created an implementation that works with a standalone Keycloak server, but now I want to include it to the embedded one. Is it possible to use a Keycloak server Embedded in a Spring Boot Application and also have an embedded custom User Storage Provider, to avoid setting up manually?

1 Like

I’m looking for the same… Please do let me know if there is anything you found regarding this…

Also, I guess the spring data source configuration might do the job… Have you tried that?

Hello, I’m looking for a similar implementation. Could really use some feedback from your experience. Thanks