Spring Boot should we always use interfaces even with one implementation
The answer to this question may vary depending on the opinions regarding the various so-called &quot;good practices&quot;.
If we take into account the dependency inversion principle (In SOLID principles), then we should always aim for our classes to depend on abstractions and not on implementations.
However we could also take into account the &quot;KISS&quot; principle (Keep it stupidly simple) and in this way I could tell you that if your application is not very large or complex, then do not use an interface.
Answering your question: &quot;what is better to use interface with one implementation and inject interface or just create a class without interface and inject class?&quot;
I recommend using an interface even if it has only one implementation, so in the future if the implementation changes, the class that depends on said interface will not be affected by said change, unless the interface signature changes as well.