When we showed dependency injection using the cake design pattern, we also mentioned that it is possible to achieve it using implicits. The idea is that services are created in one place and then we can write methods that implicitly require what the services need. By now, you should have acquired enough knowledge to be able to get to the right solution alone, so here we will just show a subset of the big example we had previously:
case class Person(name: String, age: Int)
After we have a model defined, we can create a DatabaseService as follows:
trait DatabaseService { def getPeople(): List[Person]}class DatabaseServiceImpl extends DatabaseService { override def getPeople(): List[Person] = List( Person ...