Augmenting a Spring Data Repository Through Delegation

I have recently written several posts about Kotlin’s delegation. In doing so, I realized a useful way to apply it to Spring Data repositories. This would allow Spring Data to continue sprinkling some magic, while providing a route for customization.

The code shown in this post is in Kotlin, but is still relevant to Java. This post uses R2DBC, but the content is generic enough to be applicable to any Spring Data module.