Buiten eenvoudige @Injectable() klassen ondersteunt NestJS custom providers — flexibele manieren om te definiëren wat wordt ingespoten — met behulp van injection tokens. Dit stelt je in staat om waarden in te spuiten, te configureren hoe instanties worden gemaakt, implementaties uit te wisselen, en niet-class afhankelijkheden in te spuiten.
De vier custom provider types
({
: [
{ : , : },
{ : , : { : , : } },
{
: ,
: (: ) => {
(config.());
},
: [],
},
{ : , : },
],
})
{}
