Could someone please explain to me why do we need to use the spring's dependency injection when you can just import a java class like:
Dependency Injection (and Inversion of Control) have nothing to do with
import. Dependency injection allows you to make runtime decisions instead of compile-time decisions. For example, how your class gets a database
Connection. That is configuration over hard-coding.
import statement allows you to not specify the fully-qualifed name of a class. That is, without
import java.util.Date; you can still (for example)