Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION]task任务中inject的服务名是不是必须保存一致? #1742

Open
xmsz opened this issue Feb 24, 2022 · 5 comments
Open

[QUESTION]task任务中inject的服务名是不是必须保存一致? #1742

xmsz opened this issue Feb 24, 2022 · 5 comments

Comments

@xmsz
Copy link

xmsz commented Feb 24, 2022

背景

@Provide()
export class MailService {}


@Quene()
export class Task {
  @Inject()
   recordService: MailService
   ...
}

  • 然后就会报错recordService in class Task is not valid in current context
  • 如果我改成
@Quene()
export class Task {
  @Inject()
   mailService: MailService
   ...
}

就没问题

没有细看原因和demo,但表现确实这样

如果不是在task里,其他地方 recordService: MailService 写没问题

@czy88840616
Copy link
Member

是v3 ?

@xmsz
Copy link
Author

xmsz commented Feb 24, 2022

是v3 ?

没错

@stone-jin
Copy link
Member

@quene()
export class Task {
@Inject()
recordService: MailService
...
}
是不是忘了在@Queue下面加@provide

@xmsz
Copy link
Author

xmsz commented Mar 11, 2022

是不是忘了在@Queue下面加@provide

真实代码里有加

@ddrunLandalf
Copy link

我去,还真是,一个礼拜没找到原因

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants