Spring JPA : test interface-based projection using factory

In this short article, I'll show you how you can easily test a repository method which uses interface-based projection.

Our repository:



You can use the above method this ways:



I use the ProjectionFactory as well as the SpelAwareProxyProjectionFactory for testing (spring doc).



You must also provide the setters on your interface as follow:



Happy reading...

Comments

Popular posts from this blog

Spring JPA : Using Specification with Projection

Chip input using Reactive Form