I created a project from scratch with only one injectable service that implements the OnApplicationBoostrap interface.
@Injectable()
export class AppService implements OnApplicationBootstrap {
public async onApplicationBootstrap(): Promise<void> {
console.log('foobar');
}
}
I only have one module:
@Module({
providers: [AppService],
})
export class AppModule {}
And even tho, I'm facing the same issue as Jack.
What is really happening is, when using createMicroservice(AppModule), we don't need to call init() because when creating a microservice it'll execute the initializing flow which calls the OnApplicationBootstrap, and if you call init() it'll execute the same flow again.