为什么要用 Springboot?
经过前面 SSM 框架整合以及员工管理系统的学习,对 web 开发框架有了简单的认识,现
在又蹦出来个 Springboot?使用 SSM 框架挺好的,为什么要使用 springboot 呢?这是
个很头疼的问题,为此使用 Springboot 之后,我将 SSM 和 Springboot 框架做个简单的
对比?来体现出来他们之间的差别,尝试了解为什么使用 SpringBoot。
传统项目和 Springboot 的区别
传统的项目:整合 SSM 时需要考虑各种配置文件,jar 包冲突问题,整合起来非常繁琐,
开发完毕的项目以 war 包的形式放入 tomcateweb 容器也就是 tomcate 的 webapps 目
录中,然后 tomcate 启动执行。
在 SSM 框架的学习过程中,基本上很大一部分时间都是在学习怎么整合 SpringMVC,怎
么整合 mybatis 等,怎么整合 redis,怎么整合 message 等,整合过程异常繁琐,各种
jar 包之间由于冲突问题报各种莫名奇妙的错误。而在使用各个框架的时候其难度并不大,
很大的一部分时间花在了固定模式的整合上,当时为了整合 SSM 花了将近 3 天的时间,
参考了网上很多的例子(网上的例子鱼龙混杂,很难有比较完美的例子能够将其每一步怎
么弄说清楚,为此我专门使用了最新的 spring 版本,最新的 springMVC 版本以及最新的
mybaitis 版本将其整合过程做了详细的讲解,希望以后对 SSM 的环境搭建不在浪费大量
的时间)才得以保证 SSM 完美的整合整合过程可以参见 SSM 入门实践-员工管理系统实现。
实际的开发过程中使用各个框架中基本上没有什么难度,但是又必须得整合(各个框架确
实很好用,能将繁琐的不必要的代码通过配置的方式得以实现,整个项目的代码结构很清
晰)。
Springboot 项目:
什么是 Springboot?
我这边专门查阅了官方的文档定义和目标:
Spring Boot makes it easy to create stand-alone, production-grade Spring-based Applications that
you can run. We take an opinionated view of the Spring platform and third-party libraries, so that you
can get started with minimum fuss. Most Spring Boot applications need very little Spring
configuration.
You can use Spring Boot to create Java applications that can be started by using java -jar or
more traditional war deployments. We also provide a command line tool that runs “spring scripts”.
Our primary goals are:
Provide a radically faster and widely accessible getting-started experience for all Spring
development.
Be opinionated out of the box but get out of the way quickly as requirements start to diverge
评论1