Spring supports
Spring Boot AutoConfigure
Kotlin JDSL supports Spring Boot AutoConfigure. If your project has both Spring Boot and com.linecorp.kotlin-jdsl:spring-data-jpa-support
or com.linecorp.kotlin-jdsl:spring-batch-support
dependencies, AutoConfiguration automatically creates the JpqlRenderContext
bean.
If you declare your JpqlSerializer
or JpqlIntrospector
as a bean, it will be included with the JpqlRenderContext
bean.
Spring Data Repository
If your JpaRepository
extends KotlinJdslJpqlExecutor
, you can use the extension provided by Kotlin JDSL.
If you want to use KotlinJdslJpqlExecutor
in @DataJpaTest
, you need to import KotlinJdslAutoConfiguration
in the test. Since @DataJpaTest
is a slice test, it only creates minimal beans. And the minimal bean does not include KotlinJdslAutoConfiguration
. So if you want to use the features of Kotlin JDSL in @DataJpaTest
, you need to import KotlinJdslAutoConfiguration
directly in your test.
Spring Batch
Spring Batch provides JpaPagingItemReader
and JpaCursorItemReader
for querying data with JPQL. Kotlin JDSL provides KotlinJdslQueryProvider
so that a JPQL query created in DSL can be executed in it.
Last updated