This is more of a best practice type question.
I've heard dozens of times that:
a) when autowiring in Spring it is best practice to autowire the interface 'not' the implementation.
and..
b) I have also heard that if you only have 'one' implementation, then you should not really be using an interface.
Here is my dilemma, I have an interface 'MyService' and one implementation MyServiceImpl
. I use @Autowiredz MyService in
MyController` and in 'MyServiceTest'.
I have no need for another implementation.
Clearly this violates rule b), but autowiring the implementation would violate rule a).
So my question is .... what should I do? Should I just opt not to use Spring at all in this case and just instantiate 'MyService' using the new keyword?