AnkhSpirit https://github.com/ankhspirit/nestbase/blob/e1151e809d5ebed283d814d8959d2dac6e33cf94/src/modules/example/controllers/test.controller.ts#L81 [upl-image-preview uuid=58092214-89e0-4d6f-b999-e38993333688 url=https://cn-nb1.rains3.com/3rcd/2024-02-28/1709095746-7964-image.png fullscreen_uri={URL}] @Cloneable TRANSIENT 的话 in controller 应该和 in use service 一样的数值,但是并没有增加
Cloneable AnkhSpirit 因为 providers 中有 scope 为 REQUEST 的情况,导致 controller 的 scope 也被影响,变成 REQUEST 的,具体可以看官网 https://docs.nestjs.com/fundamentals/injection-scopes#scope-hierarchy 。这种情况下导致 controller 中的 EleventhService 在每次被请求时都会重新创建,所以就出现了你截图的这种情况。 其实你不用将 NinthService 的 scope 修改,只要在 TestController 中将 NinthService 和 TenthService 在构造方法的参数中移除即可。