MicroStream with Spring

Project Setup

We use spring-boot-starter-parent for simple dependency management, versioning and plug-in configuration. And we have to include the MicroStream repository in order to access its artifacts. The property <java.version> must be set to 1.8 because Spring Boot Starter uses 1.6 as default, but MicroStream needs Java 8 at least.

The Domain Layer

With the project set up nicely, let’s now implement a simple domain layer. We will just include a single Customer class for simplicity's sake.

The Service Layer

Spring works with the repository pattern. A good way to separate your data and your services. First, we will provide a simple interface which defines the supported actions.


To set a value for the microstream.store.location parameter we will provide a simple configuration file, called application.properties. It is possible to access system properties, like user.home, with the dollar syntax.


Running the Application

And at last the Spring application itself. The command-line runner will execute all methods of the service layer. First, the sample data is created, then queries are executed, updates are performed, and at last, the data will be removed again.


In this tutorial, we learned how to create a simple CRUD application with Spring and MicroStream. As you can see it is pretty straightforward. The complete example is available on GitHub.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
MicroStream Software

MicroStream Software

Next Generation Java Serialization — Java-Native Persistence & Communication — visit us at microstream.one