Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Singleton
- class Person1 @Inject() (personApiService: PersonApiService, personDBApiService: PersonDBApiService) extends Person {
- override def gerPersonInfo(person: Person): Future[PersonInfo] = {
- ...
- }
- }
- trait PeopleManager {
- def application: Application
- def peopleList = List(
- classOf[Person1],
- classOf[Person2],
- ...
- )
- lazy val peopleInstances: List[Person] = peopleList.map(personClass => application.injector.instanceOf(personClass))
- }
- class PersonService @Inject() (val application: Application) extends PeopleManager {
- // now I can use here peopleInstances.
- }
- class MyController @Inject() (cc: ControllerComponents, peopleService: Provider[PersonServcie]) extends AbstractController(cc) {
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement