DI Injection - When to Inject

Hi folks,

Just wondering about some of the techniques used for DI injection.

Right now I'm injecting my services (i.e user service, group service) and some plugins within my handlers. Several of my handlers use the same services and plugins so I was wondering if another way to do the injection would be within an afterAspectsLoad interceptor, and this would make the injected items available across multiple handlers. is this a valid technique?

Thanks.

Nolan

Nolan,

Perhaps a simpler solution is to create a base handler that your other
handlers extend that has those services and plugins injected.

Curt

Hi Curt.

That's a great suggestion as well. I'll try that out.

Thanks!

Nolan

FWIW, I do exactly what Curt has suggested.

Regards,
Adam

+1