From 9eb404ce2403dc33f7b7f5ce9188c8c12f9b15d9 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Thu, 19 Oct 2023 16:39:41 +0200 Subject: [PATCH] Slight doc update --- README.md | 7 ++++++- radar-jersey-hibernate/README.md | 11 ++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 24e43c5..9ce201f 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,14 @@ class MyEnhancerFactory(private val config: MyConfigClass): EnhancerFactory { } class MyResourceEnhancer: JerseyResourceEnhancer { + // only classes used directly by Jersey, cannot inject them in user code override val classes: Array> = arrayOf( Filters.logResponse, Filters.cors, Filters.cache, ) + // only classes used directly by Jersey, cannot inject them in user code override val packages = arrayOf( "com.example.app.resources", ) @@ -118,7 +120,10 @@ class MyEnhancerFactory(private val config: MyConfigClass): EnhancerFactory { bind(config) .to(MyConfigClass::class.java) bind(MyService::class.java) - .to(MyService::class.java) + .to(MyServiceInterface::class.java) + .`in`(Singleton::class.java) + bindFactory(OtherServiceFactory::class.java) + .to(OtherServiceInterface::class.java) .`in`(Singleton::class.java) } } diff --git a/radar-jersey-hibernate/README.md b/radar-jersey-hibernate/README.md index 6f0b783..5b45b2c 100644 --- a/radar-jersey-hibernate/README.md +++ b/radar-jersey-hibernate/README.md @@ -6,10 +6,6 @@ Database extensions for radar-jersey. Includes support for [Hibernate](https://h Add this library to your project using the following Gradle configuration: ```kotlin -repositories { - maven(url = "https://dl.bintray.com/radar-base/org.radarbase") -} - dependencies { implementation("org.radarbase:radar-jersey-hibernate:") } @@ -23,9 +19,10 @@ Example repository code: ```kotlin class ProjectRepositoryImpl( - @Context em: Provider -): ProjectRepository, HibernateRepository(em) { - fun list(): List = transact { + @Context em: Provider, + @Context asyncService: AsyncCoroutineService, + ): ProjectRepository, HibernateRepository(em, asyncService) { + suspend fun list(): List = transact { createQuery("SELECT p FROM Project p", ProjectDao::class.java) .resultList }