title: NestJS - Cannot inject a service into a subscriber
body: <p>I have a subscriber for NestJS to listen to any create, update or delete events (TypeORM). When one of these events is fired, I'd like to use an injected service in order to create a new revision entry.</p>
  
  <p>However, it seems I cannot get the dependency loaded inside of the subscriber and the service comes back as being undefined</p>
  
  <p>Key files:</p>
  
  <ul>
  <li>EntityModificationSubscriber (Subscriber)</li>
  <li>RevisionEntity (Entity)</li>
  </ul>
  
  <p>app.module.ts</p>
  
  <pre><code>@Module({
    imports: [
        HttpModule,
        TypeOrmModule.forRoot({
            type: (process.env.DB_TYPE as any) || 'postgres',
            host: process.env.DB_HOST || '127.0.0.1',
            port: (process.env.DB_PORT as any) || 5432,
            username: process.env.DB_USER || 'root',
            password: process.env.DB_PASS || '',
            database: process.env.DB_NAME || 'test',
            entities: [join(__dirname, '**/**.entity{.ts,.js}')],
            synchronize: true,
            logging: 'all',
            logger: 'advanced-console',
            subscribers: [EntityModificationSubscriber],
        }),
        TypeOrmModule.forFeature([
            RevisionEntity,
        ]),
        TerminusModule.forRootAsync({
            // Inject the TypeOrmHealthIndicator provided by nestjs/terminus
            inject: [TypeOrmHealthIndicator, MicroserviceHealthIndicator],
            useFactory: (db, msg) =&gt; getTerminusOptions(db, msg),
        }),
        GraphQLModule.forRoot({
            debug: true,
            playground: true,
            typePaths: ['./**/*.graphql'],
        }),
    ],
    controllers: [AppController],
    providers: [
        RevisionService,
        EntityModificationSubscriber,
    ],
  })
  </code></pre>
  
  <p>entity_modification_subscriber.ts</p>
  
  <pre><code>import {EntitySubscriberInterface, EventSubscriber, InsertEvent, RemoveEvent, UpdateEvent} from 'typeorm';
  import {RevisionEntity, RevisonEntityStatus} from '../entities/revison.entity';
  import {RevisionService} from '../services/revisions.service';
  import {Injectable} from '@nestjs/common';
  
  @Injectable()
  @EventSubscriber()
  export class EntityModificationSubscriber implements EntitySubscriberInterface {
  
      constructor(private revisionService: RevisionService) {
      }
  
      // tslint:disable-next-line:no-empty
      afterInsert(event: InsertEvent&lt;any&gt;): Promise&lt;any&gt; | void {
          const revision = new RevisionEntity();
  
          revision.action = RevisonEntityStatus.Created;
      }
  
      afterUpdate(event: UpdateEvent&lt;any&gt;): Promise&lt;any&gt; | void {
      }
  
      // tslint:disable-next-line:no-empty
      afterRemove(event: RemoveEvent&lt;any&gt;) {
          // this.revisionService.createRevisionEntry(revision);
      }
  }
  </code></pre>