Home » Spring Data

Tag Archives: Spring Data

Spring Data Mock DAO

spring-interview-questions-answers

Warning, the following code example is suitable for a narrow range of use cases… but it’s strangely useful. When writing tests against Spring services or controllers, we may wish to mock the DAO layer completely. This can be achieved: @MockBean private MyDao myDao; And the mock dao is then wired into our services etc. However, there are situations where we’re ...

Read More »

A Weird Side Entrance

One of the main reasons I blog is to remind myself how easily one can use software development techniques to make bad decisions. I do it myself all the time… In a recent project, I was working with Spring Data which is able to create powerful CRUD operations over data sources if you just create an interface: interface FooRepository extends ...

Read More »

Spring Boot Data JPA – beginner guide

spring-interview-questions-answers

Databases form an integral part of computer applications. With it comes considerable amount of database operations and the corresponding code. For huge applications which have large number of tables/entities, these operations or the code is repeated and duplicated to a large extent. Eventually a programmer would like to reduce this duplicate code. Spring framework took up the challenge and provided ...

Read More »

Augmenting a Spring Data repository through delegation

I have recently written several posts about Kotlin’s delegation. In doing so, I realised a useful way to apply it to Spring Data repositories. Which would allow Spring Data to continue sprinkling some magic while providing a route for customisation. The code shown in this post is in Kotlin, but is still relevant to Java. This post uses R2DBC, but ...

Read More »

Streaming live updates from a reactive Spring Data repository

This post details a naive implementation of streaming updates from a database to any other components that are interested in that data. More precisely, how to alter a Spring Data R2DBC repository to emit events to relevant subscribers. A little bit of background knowledge of R2DBC and Spring will be helpful for this post. My previous writings, Asynchronous RDBMS access ...

Read More »