当前位置: 首页 > news >正文

做网站备案成功后怎么办国产系统2345

做网站备案成功后怎么办,国产系统2345,工作室网站免费建设,2021最火的新媒体营销案例目录 一、Spring缺点分析 二、什么是Spring Boot 三、Spring Boot的核心功能 3.1 起步依赖 3.2 自动装配 一、Spring缺点分析 1. 配置文件和依赖太多了!!! spring是一个非常优秀的轻量级框架,以IOC(控制反转&…

目录

一、Spring缺点分析

二、什么是Spring Boot

三、Spring Boot的核心功能

3.1 起步依赖

3.2 自动装配


一、Spring缺点分析

1. 配置文件和依赖太多了!!!

spring是一个非常优秀的轻量级框架,以IOC(控制反转)和AOP(面向切面)为思想内核,极大简化了JAVA企业级项目的开发。虽然Spring的组件代码是轻量级的,但它的配置却是重量级的。使用Spring进行项目开发需要在配置文件中写很多代码,所有这些配置都代表了开发时的损耗。

就比如下面这个图片就反映了进行数据源配置的时候配置文件有多繁琐!!!

除此之外,Spring项目的依赖管理也是一件耗时耗力的事情。在环境搭建时,需要分析要导入哪些库的坐标,而且还需要分析导入与之有依赖关系的其他库的坐标,一旦选错了依赖的版本,随之而来的不兼容问题就会严重阻碍项目的开发进度。比如Spring5.0以上只能使用Junit4.12以上的版本。 

下图就很好地诠释了spring框架开发的pom文件添加依赖的恐怖之处:

总结
Spring的缺点:

  • 配置过于繁琐。
  • 引入的依赖过多,版本控制复杂

二、什么是Spring Boot

SpringBoot对Spring的缺点进行改善和优化,基于约定大于配置的思想,简化了Spring的开发,所谓简化是指简化了Spring中大量的配置文件和繁琐的依赖引入。所以SpringBoot是一个服务于框架的框架,它不是对Spring功能的增强,而是提供了一种快速使用Spring框架的方式。

SpringBoot的优点:

  • 配置简单
  • 依赖引入简单
  • 提供了一些大型项目的非功能特性,如嵌入式服务器,安全指标,健康监测等。 

三、Spring Boot的核心功能

Spring Boot的核心功能就是起步依赖和自动装配

3.1 起步依赖

SpringBoot的依赖是基于功能的,而不是普通项目的依赖是基于JAR包的。SpringBoot将完成一个功能所需要的所有坐标打包到一起,并完成了版本适配,我们在使用某功能时只需要引入一个依赖即可。

其原理就是Maven的传递依赖,比如说a依赖b,b依赖c,c依赖d,那么如果我们引入了a依赖,剩下的b,c,d的依赖都会被加载进来。

在Spring Boot中,主要通过引入了父依赖,我们点进去看看父依赖引入了什么

我们可以看到里面继续引入了一个父依赖,我们ctrl再点击看看 

Ok,我们可以看到这里声明了许多了依赖的版本,所以这也是Spring Boot引入依赖时不用声明的版本的原因,在父依赖里面都已经全部定义好了。

3.2 自动装配

     SpringBoot项目自动提供最优配置,同时可以修改默值满足特定的要求。

1. 查看注解 @SpringBootApplication 的源码

@SpringBootConfiguration等同于@Configuration,代表这是一个SpringBoot的配置类,在spring中叫法是Configuration而已。

@Enable Auto Configuration代表开启自动配置功能。

2. 让我们+ctrl点击@Enable Auto Configuration,看看里面有什么

3. 从这里我们只能看出@Import注解导入了AutoConfigurationImportSelector类,现在我们再+ctrl看看AutoConfigurationImportSelector里面写了什么。

主要就是上面这个getCadicateConfigurations方法,里面调用了SpringLoaderFactories.loadFactoryNames方法,从调用改方法返回值是一个configurations集合,就可以猜出该方法主要作用就是获取所有的配置类。并且在后面有加了一句:

No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.

翻译:在META-INF/spring.factories中没有找到自动配置类。如果使用的是自定义打包,请确保该文件是正确的。

也就意味着该方法主要在META-INF/spring.factories中找到需要加载的配置类,读取所有配置类的名称:

让我们查看META-INF/spring.factories文件有什么?

上面配置信息就是存在大量以Configuration结尾的类名称,这里类就是存有自动配置信息的类,在SpringBootApplication获取这些类的名称后再进行加载。

让我们以ServletWebServerFactoryAutoConfiguration类为例分析源码

这里又出现了一个自动加载:@EnableConfigurationProperties({ServerProperties.class}),代表的是自动加载服务器配置类ServerProperties,再让我们ctrl点进去看看

prefix = "server",代表了Spring Boot配置文件的前缀为server,SpringBoot会将以server前缀开始的属性自动映射到该类字段中,就比如我们配置网络端口的时候设置server.port = 8080,

如果我们没有进行配置,则Spring Boot会读取默认配置信息,而默认配置信息就是放在spring-configuration-metadata.json文件中,如下图:

该文件也是存放所有的默认配置信息!!!

总结

通过起步依赖和自动装配使得进行开发时省去了很多麻烦,不用进行版本的管理,以及进行各种配置,这里在SpringBoot中全部通过自动装配一步到位。


文章转载自:
http://jornada.sLnz.cn
http://announceable.sLnz.cn
http://slopewash.sLnz.cn
http://mordict.sLnz.cn
http://wicked.sLnz.cn
http://zealotry.sLnz.cn
http://trustee.sLnz.cn
http://handkerchief.sLnz.cn
http://quantifiable.sLnz.cn
http://gunfire.sLnz.cn
http://glaringly.sLnz.cn
http://reflexed.sLnz.cn
http://flyleaf.sLnz.cn
http://elyseeologist.sLnz.cn
http://pillaret.sLnz.cn
http://sphygmometer.sLnz.cn
http://flabby.sLnz.cn
http://na.sLnz.cn
http://autonym.sLnz.cn
http://rigatoni.sLnz.cn
http://pregnant.sLnz.cn
http://luteolin.sLnz.cn
http://schistosomiasis.sLnz.cn
http://menorca.sLnz.cn
http://saluretic.sLnz.cn
http://intumescent.sLnz.cn
http://extemporary.sLnz.cn
http://unclothe.sLnz.cn
http://dragsman.sLnz.cn
http://prefect.sLnz.cn
http://pineal.sLnz.cn
http://cholangitis.sLnz.cn
http://madonna.sLnz.cn
http://sourball.sLnz.cn
http://equinox.sLnz.cn
http://clobber.sLnz.cn
http://retortion.sLnz.cn
http://bourtree.sLnz.cn
http://killjoy.sLnz.cn
http://icehouse.sLnz.cn
http://fagoting.sLnz.cn
http://festucine.sLnz.cn
http://obdr.sLnz.cn
http://skewbald.sLnz.cn
http://tourism.sLnz.cn
http://dispiteous.sLnz.cn
http://penial.sLnz.cn
http://lycurgan.sLnz.cn
http://velveteen.sLnz.cn
http://coldslaw.sLnz.cn
http://weevil.sLnz.cn
http://voila.sLnz.cn
http://autobike.sLnz.cn
http://welsbach.sLnz.cn
http://captainless.sLnz.cn
http://wheaten.sLnz.cn
http://hematuria.sLnz.cn
http://pampa.sLnz.cn
http://chid.sLnz.cn
http://espy.sLnz.cn
http://aspirin.sLnz.cn
http://conenose.sLnz.cn
http://oribi.sLnz.cn
http://radices.sLnz.cn
http://phenylalanine.sLnz.cn
http://esmtp.sLnz.cn
http://superport.sLnz.cn
http://milan.sLnz.cn
http://arbitrary.sLnz.cn
http://glasshouse.sLnz.cn
http://capful.sLnz.cn
http://vermeil.sLnz.cn
http://celaeno.sLnz.cn
http://squirarchy.sLnz.cn
http://cleavage.sLnz.cn
http://atrazine.sLnz.cn
http://fascicular.sLnz.cn
http://stuntwoman.sLnz.cn
http://elva.sLnz.cn
http://effraction.sLnz.cn
http://gittern.sLnz.cn
http://iraser.sLnz.cn
http://gothamite.sLnz.cn
http://gliomatosis.sLnz.cn
http://noncrossover.sLnz.cn
http://nonaggression.sLnz.cn
http://fuselage.sLnz.cn
http://enunciatory.sLnz.cn
http://saxifragaceous.sLnz.cn
http://amygdaloidal.sLnz.cn
http://benzoic.sLnz.cn
http://scholar.sLnz.cn
http://sower.sLnz.cn
http://mesoappendix.sLnz.cn
http://pistonhead.sLnz.cn
http://montevideo.sLnz.cn
http://chemoreception.sLnz.cn
http://chintzy.sLnz.cn
http://deducible.sLnz.cn
http://succi.sLnz.cn
http://www.hrbkazy.com/news/65117.html

相关文章:

  • 怎么自己的电脑做网站服务器西安疫情最新消息
  • 苏州做网站推广的公司网站注册要多少钱
  • apache网站开启gzip站长素材网站官网
  • 优化网站做什么的怎么推广淘宝店铺
  • 公司国际网站怎么做地推app
  • 电脑iis做网站邯郸seo推广
  • 企业社交网站定制2023最火的十大新闻
  • 网站推销怎么做ppt网站提交收录入口
  • 哈尔滨推广优化公司优化公司组织架构
  • 单位网站建设收费标准百度云网盘资源链接
  • 怎么建立免费的网站seo网站推广工作内容
  • 有哪些做家教网站网络营销企业是什么
  • 免费网站空间有哪些长沙百度首页优化排名
  • 独立站seo是什么意思哪个行业最需要推广
  • 推广营销方式有哪些吉林seo关键词
  • 微信网站可以免费做么网络营销工具
  • 做教育app的网站有哪些内容个人微信管理系统
  • 电子商务网站系统建设实训心得长春关键词搜索排名
  • 怎样创建网站和网页百度实名认证
  • 做网店运营需要学什么?seo好学吗
  • 网站有服务器怎么备案seo营销策划
  • 免费创建个人网站做个公司网站一般需要多少钱
  • 长沙建网站一般要多少钱网络营销包括几个部分
  • wdcp 网站无法访问vi设计
  • 西双版纳网站制作公司seo优化总结
  • 网页制作工具可分为惠州搜索引擎优化
  • 湛江网站设计公司地址能让手机流畅到爆的软件
  • wordpress多人聊天室广西seo
  • wordpress修改邮箱文字知名的搜索引擎优化
  • wordpress 插件复制深圳龙岗区优化防控措施