Spring Data query generation
Spring Data is "clever" enough to automatically generate queries based on the name of a repository's method following certain conventions. The most useful ones:
Keyword | Query |
---|---|
And | where x = ?1 and y = ?2 |
Or | where x = ?1 or y = ?2 |
Between | where x between ?1 and ?2 |
IgnoreCase | UPPER comparison on both operands |
Source : here.
Custom properties for a single test
import org.springframework.test.context.TestPropertySource;
@TestPropertySource(locations="classpath:test.properties")
public class UserRepositoryTest {
Source : here.