Use tapir router with play-framework without jsr330

Viewed 8

I use play framework with tapir. My usage similar to sample https://github.com/gaeljw/tapir-play-sample

And we define router like this:

@Singleton
class ApiRouter @Inject() (apiController: BookController, apiDocumentation: ApiDocumentation, bookEndpoints: BookEndpoints)(implicit
    val materializer: Materializer,
    ec: ExecutionContext
) extends SimpleRouter {
  
  ...

  override def routes: Routes = {

    openApiRoute
      .orElse(booksListingRoute)
      .orElse(booksStreamingRoute)
      .orElse(oneOfStreamingRoute)
      .orElse(addBookRoute)
      .orElse(getBookRoute)
  }

routes

->         /        routers.ApiRouter

Promblem, that our implementation of @Singleton is scaldi jsr330, that has some problems

How can I remove dependency on jsr330 (@Singleton) and use router as singleton without it? Note that just not using singleton leaves to performance problem.

0 Answers
Related