Skip to content

Commit

Permalink
fix: Support other custom repository for javax
Browse files Browse the repository at this point in the history
  • Loading branch information
nooose committed Jun 10, 2024
1 parent b5dadd3 commit 5346774
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ open class KotlinJdslJpaRepositoryFactoryBeanPostProcessor : BeanPostProcessor {
lateinit var kotlinJdslJpqlExecutor: KotlinJdslJpqlExecutor

override fun postProcessBeforeInitialization(bean: Any, beanName: String): Any? {
if (bean is JpaRepositoryFactoryBean<*, *, *>) {
if (bean is JpaRepositoryFactoryBean<*, *, *> && bean.hasJdsl()) {
bean.setCustomImplementation(kotlinJdslJpqlExecutor)
}

return super.postProcessAfterInitialization(bean, beanName)
}

private fun JpaRepositoryFactoryBean<*, *, *>.hasJdsl(): Boolean {
return this.objectType.interfaces
.any { it == KotlinJdslJpqlExecutor::class.java }
}
}

0 comments on commit 5346774

Please sign in to comment.