I've seen an example of IOC before, but I've never been able to make it clear, just know that the work of creating the object is given to the framework, not new, but what is the principle? Why do you want to do this or not? It can be seen that the underlying principle of the IOC is the knowledge of reflection.
Reflection is a dynamically generated object based on the given full class name (string), which allows the object to be determined at the time of generation, so it can be assumed that, in a configuration file, the file is already well-written with the fully qualified name of the Bookdaoimpl class. The real implementation class fully qualified name of the Bookdao is obtained by reading the file, and then the object of the class is dynamically generated at run time by the reflection technique, which is eventually assigned to the Bookdao interface
Large decoupling can be achieved by modifying the configuration file rather than by modifying the code.
Then using reflection to create the actual implementation class for Bookdao at run time, including the creation of the Bookserviceimpl, the spring IOC container will do the work for us, The only thing we have to do is to tell the IOC container what classes to create and what classes to inject in the configuration file as the classes and other class-dependent classes that need to be created.
Spring's IOC Learning