spring boot withspring mvcWhat is the difference?
spring bootJust a configuration tool,Integration tools, auxiliary tools.
springmvcIt's the framework,The actual code running in the project
Spring The framework is like a family, with many derivative products such as boot、security、jpaetc. But theirBaseAllSpring ofiocand aop. ioc Provides a dependency injection container. aopSolve cross-sectional programming, and then implement advanced features of other extended products based on both.
Spring MVCIt is based onServlet One of MVC frameMain solution WEB Development issues,because Spring The configuration is very complex, with variousXML、 JavaConfig、hinIt's quite cumbersome to deal with. Therefore, in order to simplify the use of developers,Creatively launchedSpring boot, agreement is better than configuration, simplifyingspringconfiguration process.
To put it simpler:Spring Initial use“Factory model”(DI)and“Agent Mode”(AOP) Decoupled application components. Everyone thought it was very useful, so they made a MVCFramework (some useSpring Decoupled components), use development web application( SpringMVC ). Then I found that every time I develop, I wrote a lot of boilerplate code, in order to simplify the workflow,So some“Lazy Integration Package”(starter), this set is Spring Boot。
Spring MVCFunctions
Spring MVCProvides a lightly coupled way to developwebapplication.
Spring MVCyesSpringa module, awebframe.passDispatcher Servlet, ModelAndView and View Resolver, developmentwebApplications are easy. The problem area to be solved is website application or service development——URLrouting,Session, template engine, staticWebResources and more.
Spring BootFunctions
Spring BootAutomatic configuration is realized, reducing the complexity of project construction.
As we all knowSpringThe framework needs to be configured a lot.Spring BootIntroducing the concept of automatic configuration makes it easy to set up your project.Spring BootNot provided by itselfSpringThe core features and extension functions of the framework are only used to quickly and agilely develop the new generation ofSpringFramework application. That is, it is not used as a substituteSpringThe solution, butSpringFrames are tightly integrated for liftingSpringA tool for developers to experience. At the same time, it integrates a large number of commonly used third-party library configurations(For exampleJackson, JDBC, Mongo, Redis, Mailetc.),Spring BootThese third-party libraries in the application can be used out of the box with almost zero configuration(out-of-the-box), most of themSpring BootApplications only require a very small amount of configuration code, and developers can focus more on business logic.
Spring BootIt is just a carrier that helps you simplify the project construction process. If the carrying isWEBProject, useSpring MVCAsMVCThe framework, then the workflow is exactly the same as what you described above, because this part of the work isSpring MVCDo it insteadSpring Boot。
For users, use itSpring BootLater, the project initialization method has changed and the configuration file has changed. In addition, it does not require separate installation.TomcatThis type of container server,mavenCall it outjarThe package is just a website, but your core business logic implementation and business process implementation have not changed at all.
Therefore, in the most concise language, it is:
Spring It's one“engine”;
Spring MVC It is based onSpringOne of MVC frame;
Spring Boot It is based onSpring4A set of rapid development integration packages for registration of the condition.