Hi. I was trying the other day to use the new version of the framework to achieve something like Spring Boot does in Java with with it's IOC Container, and I noticed that website lacks a little more information about this. I wanted to write something like:
export default interface FooRepositoryInterface {
findAll(): Promise<Foo>
}
export default class FooRepository implements FooRepositoryInterface{
findAll(): Promise<Foo> {
// Implementation
}
}
export default interface FooServiceInterface {
list(): Promise<Foo>
}
export default class FooService implements FooServiceInterface {
constructor(public FooRepositoryInterface repository) {}
list(): Promise<Foo> {
return repository.findAll()
}
}
export default class FooController {
constructor(public FooServiceInterface service) {}
index() {
service.list()
}
}
It is possible to achieve this kind of behavior with the current version of the framework? If it is, could you guys provide me some examples or guides in how to register the dependencies on the IOC container correctly? I tried to register the classes on the provider but I could achieve the result I wanted.
Thanks in advance.
Hi. I was trying the other day to use the new version of the framework to achieve something like Spring Boot does in Java with with it's IOC Container, and I noticed that website lacks a little more information about this. I wanted to write something like:
It is possible to achieve this kind of behavior with the current version of the framework? If it is, could you guys provide me some examples or guides in how to register the dependencies on the IOC container correctly? I tried to register the classes on the provider but I could achieve the result I wanted.
Thanks in advance.