-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created guice modules for BookService and BookRepository
- Loading branch information
1 parent
0c783b6
commit 02e7180
Showing
5 changed files
with
38 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/scala/com/bookworm/application/books/adapter/repository/BookRepositoryModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.bookworm.application.books.adapter.repository | ||
|
||
import cats.effect.Sync | ||
import com.bookworm.application.books.domain.port.outbound.BookRepository | ||
import com.google.inject.{AbstractModule, Scopes, TypeLiteral} | ||
import net.codingwell.scalaguice.ScalaModule | ||
|
||
class BookRepositoryModule[F[_]: Sync] extends AbstractModule with ScalaModule { | ||
|
||
override def configure(): Unit = | ||
bind(new TypeLiteral[BookRepository[F]]() {}) | ||
.to(new TypeLiteral[BookRepositoryImpl[F]]() {}) | ||
.in(Scopes.SINGLETON) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/scala/com/bookworm/application/books/adapter/service/BookServiceModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.bookworm.application.books.adapter.service | ||
|
||
import cats.effect.Sync | ||
import com.bookworm.application.books.domain.port.inbound.BookService | ||
import com.google.inject.{AbstractModule, Scopes, TypeLiteral} | ||
import net.codingwell.scalaguice.ScalaModule | ||
|
||
class BookServiceModule[F[_]: Sync] extends AbstractModule with ScalaModule { | ||
|
||
override def configure(): Unit = | ||
bind(new TypeLiteral[BookService[F]]() {}) | ||
.to(new TypeLiteral[BookServiceImpl[F]]() {}) | ||
.in(Scopes.SINGLETON) | ||
|
||
} |