title: How to inject a nestjs service into another service when both belong to the same module?
body: <p>I have the following scenario in NestJS:</p>
  <pre><code>// user.service.ts
  @Injectable()
  export class UserService {
    constructor(
      private readonly userRepository: UserRepository,
      private readonly userProfileService: UserProfileService,
    ) {}
  }
  
  
  // user-profile.service.ts
  @Injectable()
  export class UserProfileService {
    constructor(
      private readonly userProfileRepository: UserProfileRepository,
    ) {}
  }
  
  
  // user.module.ts
  @Module({
  imports: [DataRepositoryModule], // Required for the repository dependencies
    providers: [UserService, UserProfileService],
    exports: [UserService, UserProfileService],
  })
  export class UserModule {}
  </code></pre>
  <p>However, when I try to use the UserService inside a controller from another module, I get the following error:</p>
  <pre><code>Nest can't resolve dependencies of the UserService (UserRepository, ?). Please make sure that the argument dependency at index [1] is available in the UserModule context.
  Potential solutions:    
  - If dependency is a provider, is it part of the current UserModule?
  - If dependency is exported from a separate @Module, is that module imported within UserModule?
  @Module({
          imports: [ /* the Module containing dependency */ ]
        })
  </code></pre>
  <p>Controller code:</p>
  <pre><code>@Controller()
  export class UserController {
    constructor(private readonly userService: UserService) {}
  }
  </code></pre>
  <p>Controller module:</p>
  <pre><code>@Module({
    imports: [],
    providers: [],
    controllers: [UserController],
  })
  export class UserManagementModule {}
  </code></pre>
  <p>Main app.module.ts:</p>
  <pre><code>@Module({
    imports: [
      UserManagementModule,
      UserModule,
      DataRepositoryModule.forRoot(),
    ],
    controllers: [],
    providers: [],
  })
  export class AppModule {}
  </code></pre>
  <p>I'm confused because I'm doing exactly what the error suggests, adding both services inside the providers array (UserModule). What could I be missing?</p>