April 2018
Intermediate to advanced
396 pages
11h 8m
English
In the preceding code, we saw a bunch of components with their implementations that declare dependencies to others. We still haven't seen how everything will be used together. By defining our components as traits, we can just mix them in together and they will be available to us. This is how we have done it:
object ApplicationComponentRegistry extends UserComponent with DaoComponent with DatabaseComponent with MigrationComponent { override val dao: ApplicationComponentRegistry.Dao = new Dao override val databaseService: DatabaseService = new H2DatabaseService("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "", "") override val migrationService: ApplicationComponentRegistry.MigrationService = new MigrationService override val userService ...
Read now
Unlock full access