简体   繁体   中英

DI and IOC in spring mvc implementation

I am new to spring mvc and DI. I have came to know about the flow of the spring project and i know how the web projects in spring mvc is developed and worked on few projects too. All the annotation uses and xml configuration files in the spring mvc. But i am confused where the DI is used? and how the DI is implemented in spring with the help of IOC??

Can anyone please explain me the concept of DI and IOC and their implementation in spring mvc.

Thanks in advance!!!

DI and IOC happening through web.xml where you created the dispatcherservlet. From Spring MVC docs : The DispatcherServlet, provides a shared algorithm for request processing while actual work is performed by configurable, delegate components The DispatcherServlet, as any Servlet, needs to be declared and mapped according to the Servlet specification using Java configuration or in web.xml. In turn the DispatcherServlet uses Spring configuration to discover the delegate components it needs for request mapping, view resolution, exception handling, and more.

internally it will register Spring mvc app and it will create an object and inject dependencies .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM