When should I use Dependency Injection and when utility methods?
- by Roman
I have a Java EE project with Spring IoC container.
I've just found in Utils class static method sendMail(long list of params). I don't know why but I feel that it would look better if we had separate class (Spring bean with singleton scope) which will be responsible for sending email. But I can't find any arguments which can prove my position.
So, are there any pros (or cons) in using DI in this (rather general) situation?