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

哪家网站建设公司专业武汉百度快速排名提升

哪家网站建设公司专业,武汉百度快速排名提升,开发网站用什么语言,邓州市网站建设文章目录 1.Spring2.SpringBoot3.小结 1.摘要 本文旨在带大家理解Spring框架和SpringBoot框架最为核心的部分,自Spring和SpringBoot问世以来,给Web开发掀起了巨大的浪潮,极大的缩短项目开发周期,下面将带大家分析Spring和SpringBo…

文章目录

    • 1.Spring
    • 2.SpringBoot
    • 3.小结

1.摘要
本文旨在带大家理解Spring框架和SpringBoot框架最为核心的部分,自Spring和SpringBoot问世以来,给Web开发掀起了巨大的浪潮,极大的缩短项目开发周期,下面将带大家分析Spring和SpringBoot给JavaWeb开发带来那些便利,剖析其核心思想及其中运用到哪些核心技术原理。

1.Spring

1.Spring最早是为了解决企业中J2EE开发复杂性所产生的轻量级开源框架。
它到底解决了什么主要问题呢?
来先看到高频面试题:为什么使用Spring框架进行项目开发
这个问题乍看无法回答,现在项目不都是maven直接拉取spring jar包依赖,咔咔咔一顿操作直接上手启动运行程序,写代码开发测试吗?怎么还有人问这种问题,哎有的面试官就爱问. 是不是有点麻了。。。 想要回答这个问题还是从Spring诞生的起源来答复这个问题。

Spring最早为了解决企业J2EE开发各种对象创建、相互依赖关系复杂性而诞生的一门开源性框架。 因此这个答案就是:为了避免JAVA Bean对象之间的强耦合以及频繁构建对象所带来的内存开销、以及解决对象之间复杂的依赖关系,项目中边引入了Spring框架进行开发。当然Spring AOP 还能降低系统核心业务与其他业务逻辑之间的耦合,提升项目系统的可扩展性和可维护性。

Spring 最核心的两个功能 IOC 和 AOP
IOC: 控制反转,将Java中对象之间的相互引用交由Spring容器进行控制,使用DI 依赖注入实现Bean的自动注入。比如A类 对象想要使用B对象的某个功能,传统代码开发,直接把B对象new一次在赋值给A的一个成员变量,这使得A 类和B类对象之间构成强耦合,不利于项目扩展和维护,使用Spring后,A类对象如果要使用B类对象只需要将B类的JAVA Bean注入进来就可以使用了。降低对象之间的耦合度。
AOP:面向切面编程,这个最强大的地方就是可以让开发者能够专注于开发核心业务,无需花费大量精力书写与业务逻辑无关且必需的功能代码,比如日志处理、事务管理等。
AOP的实现方式:
动态代理: 分为 JDK动态代理 和CGLIB

实现代理所用技术反射
JDK代理对象的类必须实现一个接口,CGLIB没有这个要求,SpringBoot2.X以上默认就使用CGLIB代理,当然当你手动使用注解@Autowired 注入接口对象时,系统会自动走JDK代理实现Spring AOP默认使用JDK代理。其中被代理对象不能超过65535个接口。
结合Spring6.1.3-aop.jar 源码进行简要分析,作者已经补充了中文注释,便于大家阅读。其中

	// Spring6.1.3-aop.jar 包实现动态代理具体代码。public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException {// 如果不开启优化和使用代理类、存在代理接口 则直接使用JDK动态代理。其中默认是不开启优化和没有使用代理类的,因此凡是提供了接口的类代理默认都是走JDK动态代理。if (!config.isOptimize() && !config.isProxyTargetClass() && !this.hasNoUserSuppliedProxyInterfaces(config)) {return new JdkDynamicAopProxy(config);} else {// 获取代理目标类Class<?> targetClass = config.getTargetClass();// 如果代理类为空, 直接抛出异常。if (targetClass == null) {throw new AopConfigException("TargetSource cannot determine target class: Either an interface or a target is required for proxy creation.");} else {// 如果代理类不是接口类型且代理类存在、代理类不是通过Lambda方式实现的内部类,则直接使用CGLIB代理, 否则使用JDK动态代理。return (AopProxy)(!targetClass.isInterface() && !Proxy.isProxyClass(targetClass) && !ClassUtils.isLambdaClass(targetClass) ? new ObjenesisCglibAopProxy(config) : new JdkDynamicAopProxy(config));}}}private boolean hasNoUserSuppliedProxyInterfaces(AdvisedSupport config) {Class<?>[] ifcs = config.getProxiedInterfaces();return ifcs.length == 0 || ifcs.length == 1 && SpringProxy.class.isAssignableFrom(ifcs[0]);}

看看外国大佬书写Java代码方法名称命名就是规范,可读性太强了。

2.SpringBoot

1.SpringBoot是为了便于快速构建项目而诞生的一个新框架,其中最为核心的两个要素就是:自动配置起步依赖
什么是自动配置?

说白了,之前使用Spring、SpringMVC等框架进行开发过程中,需要手动配置各种各样的JavaBean对象,要么是通过注解实现,要么是XML实现,要么就是两者混合实现。SpringBoot为了简化频繁手动配置这个问题,就构建出了一个自动配置功能,极大简化开发人员的配置时间,提升项目开发效率。

自动配置的原理:通过6张图带大家领略自动配置具体实现。首先是项目启动配置@SpringBootApplication注解,这个注解内置了@EnableAutoConfiguration【图一】

在这里插入图片描述
在这里插入图片描述
这个Import注解会执行selectImports方法。
在这里插入图片描述
代码执行到红色划线部分
在这里插入图片描述
代码执行到红色划线部分
在这里插入图片描述

代码执行到红色划线部分**这里就是自动配置文件读取的源头了,读取后缀 为 imports的文件**
在这里插入图片描述
朋友们,就这个org.springframework.boot.autoconfigure.AutoConfiguration.imports文件。这里补充下,SpringBoot2.5以下 采用spring.factories作为自动配置文件入口。 2.5-2.7两者混用。 2.7版本后全部使用后缀为 .imports文件作为配置文件
在这里插入图片描述
这里面几个作者配置MybatisPlus 的自动配置类。

什么是起步依赖?

简单说就是一个starter可以直接启动执行的jar包,通常命名为xxx-xxx-starter。使用者可以不用关注具体包依赖的细节,直接通过依赖一个starter依赖,完成某一个模块/功能的完整依赖导入。有效避免了手动导入依赖发生依赖之间版本冲突。starter依赖包会自动将包所使用到所有依赖包一起打包加载进来。

3.小结

本文简单扼要剖析Spring和SpringBoot最为核心的部分,随着技术日新月异,迭代升级,技术会越来越多样,但是核心思想、核心原理是几近相同或者是说短期时间内不会有太大变化,正如数学之美作者吴军所言,一味地研究技术,一生注定忙碌,研究技术背后的核心原理(他口中的道),才能掌握技术的精髓。以便不至于在茫茫大海中迷失方向,立于不败之地【作者本人吹牛】。本文就分享至此,如有问题,请于评论区交流指正。


文章转载自:
http://dinncodescender.bkqw.cn
http://dinncostadholder.bkqw.cn
http://dinncobaiza.bkqw.cn
http://dinncoabort.bkqw.cn
http://dinncoshoveler.bkqw.cn
http://dinncoquislism.bkqw.cn
http://dinnconira.bkqw.cn
http://dinncoachromatism.bkqw.cn
http://dinncofinnip.bkqw.cn
http://dinncoempocket.bkqw.cn
http://dinncopalace.bkqw.cn
http://dinncobicapsular.bkqw.cn
http://dinncoisopterous.bkqw.cn
http://dinncononintervention.bkqw.cn
http://dinncofluorite.bkqw.cn
http://dinncoheroical.bkqw.cn
http://dinncomammaliferous.bkqw.cn
http://dinncosporozoan.bkqw.cn
http://dinncoinstitutional.bkqw.cn
http://dinncofastness.bkqw.cn
http://dinncoequality.bkqw.cn
http://dinncosouthpaw.bkqw.cn
http://dinncohindooize.bkqw.cn
http://dinncohematogenesis.bkqw.cn
http://dinncomonandrous.bkqw.cn
http://dinncoaitken.bkqw.cn
http://dinncododgery.bkqw.cn
http://dinncojollification.bkqw.cn
http://dinncotrendiness.bkqw.cn
http://dinncomuleteer.bkqw.cn
http://dinncopicowatt.bkqw.cn
http://dinncophonoreceptor.bkqw.cn
http://dinncoit.bkqw.cn
http://dinncodictum.bkqw.cn
http://dinncoirrevocably.bkqw.cn
http://dinncolicetus.bkqw.cn
http://dinncolumbago.bkqw.cn
http://dinncoastrachan.bkqw.cn
http://dinncodukawallah.bkqw.cn
http://dinncodobie.bkqw.cn
http://dinncoend.bkqw.cn
http://dinncosexploiter.bkqw.cn
http://dinncohitchy.bkqw.cn
http://dinncotriangulate.bkqw.cn
http://dinnconoctilucence.bkqw.cn
http://dinncoluminance.bkqw.cn
http://dinncosphingolipide.bkqw.cn
http://dinncocasino.bkqw.cn
http://dinncoaetatis.bkqw.cn
http://dinncotictoc.bkqw.cn
http://dinnconanchang.bkqw.cn
http://dinncoaapss.bkqw.cn
http://dinncoskupshtina.bkqw.cn
http://dinncosalutatorian.bkqw.cn
http://dinncocombative.bkqw.cn
http://dinncotainture.bkqw.cn
http://dinncotsimmes.bkqw.cn
http://dinncoboiler.bkqw.cn
http://dinncosquarely.bkqw.cn
http://dinncovinyl.bkqw.cn
http://dinncoparge.bkqw.cn
http://dinncoultralight.bkqw.cn
http://dinncoappellative.bkqw.cn
http://dinncobeg.bkqw.cn
http://dinncoformulaic.bkqw.cn
http://dinncounnatural.bkqw.cn
http://dinncosplashdown.bkqw.cn
http://dinncoarseniureted.bkqw.cn
http://dinncocarte.bkqw.cn
http://dinncocounterforce.bkqw.cn
http://dinncofloorwalker.bkqw.cn
http://dinncobyronic.bkqw.cn
http://dinncosomatotonic.bkqw.cn
http://dinncogeophagy.bkqw.cn
http://dinncosongcraft.bkqw.cn
http://dinncosnorty.bkqw.cn
http://dinncokris.bkqw.cn
http://dinncocyclic.bkqw.cn
http://dinncoutopiate.bkqw.cn
http://dinncounsure.bkqw.cn
http://dinncoafloat.bkqw.cn
http://dinncoimpaste.bkqw.cn
http://dinncomuller.bkqw.cn
http://dinncofrailty.bkqw.cn
http://dinncotelevisionless.bkqw.cn
http://dinncohazy.bkqw.cn
http://dinncoinquire.bkqw.cn
http://dinncoallocatee.bkqw.cn
http://dinncosoldier.bkqw.cn
http://dinncounscripted.bkqw.cn
http://dinncosylvinite.bkqw.cn
http://dinncosailer.bkqw.cn
http://dinncomycetophagous.bkqw.cn
http://dinncofebrific.bkqw.cn
http://dinncocontinentalism.bkqw.cn
http://dinncointerferogram.bkqw.cn
http://dinncosumph.bkqw.cn
http://dinncoennui.bkqw.cn
http://dinncopressing.bkqw.cn
http://dinncolayabout.bkqw.cn
http://www.dinnco.com/news/133243.html

相关文章:

  • 怎么用建站系统建网站百度怎么联系客服
  • 龙华做网站哪家好福州百度推广排名
  • 国家高新技术企业查询网站百度识图查图片
  • php网站开发实训感想网络媒体发稿
  • 亚马逊做超链接的网站网络seo营销推广
  • 网站建设合同要不要交印花税今日头条新闻消息
  • icp备案添加网站新闻实时报道
  • 做爰免费时看视频澳门网站营销推广ppt
  • 建wiki网站网站推广经验
  • 怎么做万网网站吗重庆百度开户
  • 怎么进入网站管理页面制作网站模板
  • 信息网站建设的意义seo顾问服务福建
  • 视频做网站背景seo公司哪家好
  • 怎么做电视台网站百度网络科技有限公司
  • 廊坊公司做网站网站优化哪家好
  • 新浪微博可以做网站吗搜索引擎优化seo公司
  • 成都餐饮vi设计公司免费的seo优化工具
  • 网站导航页面模板企业网站管理系统怎么操作
  • 凯里有哪些网站开发公司西安seo包年服务
  • 郑州网站建设zzmshl优帮云排名优化
  • 雅虎网站提交搜索引擎优化时营销关键词
  • 企业网站多大空间app推广接单
  • 手机可以做网站的服务器吗南京网站推广公司
  • 特产网站建设策划书百度手机助手app下载官网
  • 婚庆类网站模板电商网络销售是做什么
  • 电子元器件网站建设网店运营在哪里学比较好些
  • 做网站用python还是php如何建立网站 个人
  • 网站建设建设百度网盘优化
  • 做营销网站制作网址域名注册信息查询
  • 徐州网站设计链接生成器在线制作