手机手机端网站建设系统软件开发服务

pingmian/2025/10/9 1:01:03/文章来源:
手机手机端网站建设,系统软件开发服务,制作网线颜色顺序,专业生产车间设计图纸网站推荐阅读#xff1a;Spring全家桶笔记#xff1a;SpringSpring BootSpring CloudSpring MVC疫情期间“闭关修炼”#xff0c;吃透这本Java核心知识#xff0c;跳槽面试不心慌2020“闭关”跳槽季#xff0c;啃透分布式三大技术#xff1a;限流、缓存、通讯基本环境开发工具…推荐阅读Spring全家桶笔记SpringSpring BootSpring CloudSpring MVC疫情期间“闭关修炼”吃透这本Java核心知识跳槽面试不心慌2020“闭关”跳槽季啃透分布式三大技术限流、缓存、通讯基本环境开发工具:Intellij IDEA 2017(盗)版java版本1.8.0_151spring的github地址:spring-framework准备git clone或直接下载github上的spring源码导入idea中在项目路径下执行gradle build (如果本机没有gradle环境或者版本差很多就用gradlew代替)会build很久可以事先将阿里的maven仓库地址加到repositories中像这样:repositories { maven { url http://maven.aliyun.com/nexus/content/groups/public/ } maven { url https://repo.spring.io/plugins-release }}会用到的缩写:ApplicationContext - ACApplicationContextInitializer - ACIBeanFactory - BFApplicationListener - ALEnvironmentPostProcessor - EPPspring boot 应用的启动/*** author pk* date 2018/02/22*/SpringBootApplicationpublic class SpringBootTwoStudyApplication {public static void main(String[] args) {SpringApplication springApplication new SpringApplication(SpringBootTwoStudyApplication.class);//可以在run之前,对AC进行一些自定义的配置,添加点ApplicationListener,ApplicationContextInitializer啥的springApplication.run(args);}}一.SpringApplication的初始化代码如下public SpringApplication(ResourceLoader resourceLoader, Class... primarySources) { this.resourceLoader resourceLoader; Assert.notNull(primarySources, PrimarySources must not be null); this.primarySources new LinkedHashSet(Arrays.asList(primarySources));//1 this.webApplicationType deduceWebApplicationType();//2 setInitializers((Collection) getSpringFactoriesInstances( ApplicationContextInitializer.class));//3 setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class));//4 this.mainApplicationClass deduceMainApplicationClass();//5 }1.设置启动类primarySources到对应属性这个启动类就是在初始化SpringApplication时候的参数,可以有多个2.获取web应用类型根据当前classpath下存在的类来判断的:如果存在org.springframework.web.reactive.DispatcherHandler,就是REACTIVE如果不存在org.springframework.web.servlet.DispatcherServlet或者javax.servlet.Servlet,就是NONE否则,就是SERVLET3.设置ApplicationContextInitializer代码如下:private Collection getSpringFactoriesInstances(Class type, Class[] parameterTypes, Object... args) { ClassLoader classLoader Thread.currentThread().getContextClassLoader();//3.1 Set names new LinkedHashSet( SpringFactoriesLoader.loadFactoryNames(type, classLoader));//3.2 List instances createSpringFactoriesInstances(type, parameterTypes, classLoader, args, names);//3.3 AnnotationAwareOrderComparator.sort(instances);//3.4 return instances; }3.1 获取线程上下文ClassLoaderTODO(ClassLoader的相关解释)3.2 使用SpringFactoriesLoader加载出classpath下所有路径为META-INF/spring.factories的资源文件,并读取key为ApplicationContextInitializer的值会得到如些几个类(实际是全称类名)SharedMetadataReaderFactoryContextInitializerAutoConfigurationReportLoggingInitializerConfigurationWarningsACIContextIdACIDelegatingACIServerPortInfoACI3.3 利用反射创建出上述ACI的实例3.4 排序根据Ordered接口/PriorityOrder注解/Order注解去排 其他地方的排序基本也是按照这个规则来排的4.设置listener跟设置ACI的方法一样,也是读取spring.factories文件中的对应key项所对应的所有类名,然后实例化、排序. 得到如下几个ApplicationListener:BackgroundPreinitializerClearCachesALParentContextCloserALFileEncodingALAnsiOutputALConfigFileALDelegatingALClasspathLoggingALLoggingALLiquibaseServiceLocatorAL5.设置mainApplicationClass就是找到main方法所在的类.是唯一的,跟上面的primarySources不是一回事二.SpringApplication的run(String … args)方法代码如下:public ConfigurableApplicationContext run(String... args) { StopWatch stopWatch new StopWatch(); stopWatch.start();//1 ConfigurableApplicationContext context null; Collection exceptionReporters new ArrayList(); configureHeadlessProperty();//2 SpringApplicationRunListeners listeners getRunListeners(args);//3 listeners.starting();//4 try { ApplicationArguments applicationArguments new DefaultApplicationArguments( args);//5 ConfigurableEnvironment environment prepareEnvironment(listeners, applicationArguments);//6 configureIgnoreBeanInfo(environment);//7 Banner printedBanner printBanner(environment);//8 context createApplicationContext();//9 exceptionReporters getSpringFactoriesInstances( SpringBootExceptionReporter.class, new Class[] { ConfigurableApplicationContext.class }, context);//10 prepareContext(context, environment, listeners, applicationArguments, printedBanner);//11 refreshContext(context);//12 afterRefresh(context, applicationArguments);//13 listeners.finished(context, null);//14 stopWatch.stop(); //15 if (this.logStartupInfo) { new StartupInfoLogger(this.mainApplicationClass) .logStarted(getApplicationLog(), stopWatch); } callRunners(context, applicationArguments);//16 return context; } catch (Throwable ex) { handleRunFailure(context, listeners, exceptionReporters, ex); throw new IllegalStateException(ex); } }1. 创建一个StopWatch用于记录启动的时间2. 配置java.awt.headless属性,默认为true这个headless是一种模式,是指缺少显示屏、键盘或者鼠标时的系统配置 我找了spring和spring boot的源码,只有ImageBanner里面用到了3.从spring.factories中加载出SpringApplicationRunListener,并构建一个SpringApplicationRunListenersStringApplicationListeners就是对对个SpringApplicationRunListener的包装 现在看只有一个具体实现类EventPublishingRunListener虽然这个类叫做listener,但其实起的作用是传播事件,更像是一个ApplicationEventMulticaster。 spring boot启动过程中的事件,主要由这个类来传播4.发布一个ApplicationStartingEvent事件关于spring事件发布机制请看spring事件机制 响应的ALLoggingAL初始化日志系统 做法是按照logbacklog4jjul的顺序查找classpath下存在的相关类LiquibaseServiceLocatorAL实在是没有用过这个东西不知道这个LiquibaseService是个啥…5.根据启动时的命令行参数构建一个ApplicationArgumentsApplicationArguments的接口定义:public interface ApplicationArguments { String[] getSourceArgs(); //--开头的参数 Set getOptionNames(); boolean containsOption(String name); //--开头的参数是允许重复定义的不会覆盖 List getOptionValues(String name); List getNonOptionArgs();}这个类的作用就是解析所有的启动参数的6.prepareEnvironment():创建并配置environment代码如下private ConfigurableEnvironment prepareEnvironment( SpringApplicationRunListeners listeners, ApplicationArguments applicationArguments) { ConfigurableEnvironment environment getOrCreateEnvironment();//6.1 configureEnvironment(environment, applicationArguments.getSourceArgs());//6.2 listeners.environmentPrepared(environment);//6.3 bindToSpringApplication(environment);//6.4 if (this.webApplicationType WebApplicationType.NONE) { environment new EnvironmentConverter(getClassLoader()) .convertToStandardEnvironmentIfNecessary(environment); } ConfigurationPropertySources.attach(environment);//6.5 return environment; }6.1 根据WebApplicationType创建对应类型的environment关于spring中Environment/PropertySource的介绍:根据webApplicationTypeSERVLET - StandardServletEnvironmentNONE/REACTIVE - StandardEnvironment初始化的时候会在构造函数中调用customizePropertySources()方法其结果是会在environment的propertySources属性的propertySourcesList列表中加入以下PropertySource代表ServletConfig的构建参数的名为servletConfigInitParams的StubPropertySource(目前只是作为占位符存在)代表ServletContext的构建参数的名为servletContextInitParams的StubPropertySource(目前只是作为占位符存在)代表jvm属性参数的名为systemProperties的MapPropertySource(来源于System.getProperties()方法)代表环境变量的名为systemEnvironment的SystemEnvironmentPropertySource(来源于System.getEnv()方法)6.2 配置environment配置PropertySources 看看SpringApplication的defaultProperties属性是否为空如果不为空则加入一个MapPropertySource到propertySources中。这个defaultProperties属性可以在SpringApplication调用run方法之前通过setDefaultProperties()方法设置看看有没有命令号参数如果有则创建一个SimpleCommandLinePropertySource加入到propertySources中配置activeProfiles:就是将spring.profiles.active属性的值作为数组读入6.3 listeners发布一个ApplicationEnvironmentPreparedEvent这是一个很重要的事件响应的listener有很多ConfigFileApplicationListener 从spring.factories中读取所有的EnvironmentPostProcessor它自己也是个EPP。排序然后逐个调用 SystemEnvironmentPropertySourceEPP:替换systemEnvironment为其内部类OriginAwareSystemEnvironmentPropertySourceSpringApplicationJsonEPP解析spring.application.json属性作为JsonPropertySource加入propertySources中CloudFoundryVcapEPP:VCAP相关不懂略过ConfigFileAL(自己) 添加一个RandomValuePropertySource作用是设置所有random.int/long开头的属性为一个随机值从spring.factories中读取PropertySourceLoader PropertiesPropertySourceLoader读取.properties配置文件YamlPropertySourceLoader读取.yaml配置文件根据activeProfiles解析每个对应的配置文件成OriginTrackedMapPropertySource加入到propertySources中6.4 将environment绑定到SpringApplication中todo…6.5 往propertySources中加入一个ConfigurationPropertySourcesPropertySource7.配置一个spring.beaninfo.ignore属性,默认为true8.打印banner9.根据webApplicationType构建ApplicationContextSERVLET - AnnotationConfigServletWebServerACREACTIVE - ReactiveWebServerACNONE - AnnotationConfigAC 按照继承结构DefaultResourceLoader:ResourceLoader的默认实现作用就是加载Resource内部有个比较重要的ProtocolResolver集合属性具体使用请看ProtocolResolver解析AbstractAC配置了一个ResourcePatternResolver具体请看Resource相关GenericAC初始化了一个BeanFactory具体类型是DefaultListableBeanFactory作者pumpkin_pk原文链接https://blog.csdn.net/yuxiuzhiai/article/details/79074249

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/89126.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

淄博找能做网站的公司江苏大汉建设实业集团网站

整数和浮点数在内存中的存储方式是不一样的,今天,我们来具体学习一下 文章目录 整数在内存中的存储浮点数在内存中的存储 整数在内存中的存储 我们在之前就已经了解过了整数有原码,反码,补码的形式,这三种方式都是二进…

东盟建设投资有限公司网站软文广告图片

文章目录 总结Hackergame2023更深更暗组委会模拟器猫咪小测标题HTTP集邮册Docker for everyone惜字如金 2.0Git? Git!高频率星球低带宽星球小型大语言模型星球旅行日记3.0JSON ⊂ YAML? 总结 最近看到科大在举办CTF比赛,刚好我学校也有可以参加,就玩了…

企业网站制作简介百度seo查询系统

转载:https://www.cnblogs.com/ccdev/archive/2012/12/19/2825355.html 废话不多说,常用的代码积淀下来。 一、懒汉模式:即第一次调用该类实例的时候才产生一个新的该类实例,并在以后仅返回此实例。 需要用锁,来保证其…

有什么网站建设类岗位公司简介模板文案

序言 三个多月过去了,我又来写博客了,这一次从零开始学习网络协议。 总的来说,计算机网络很像现实生活中的快递网络,其最核心的目标,就是把一个包裹(信息)从A点发送到B点去。下面是一些共同的…

宿迁网站建设要多少钱个人网页设计教程大全

文旅游戏在各个领域中找到了广泛的应用,为用户提供了独特的文化体验和娱乐享受。下面将探讨文旅游戏在多个应用场景中的丰富表现。 1. 旅游推广与目的地引导 文旅游戏成为旅游局的一项有力工具,能够将目的地的历史、文化和特色景点巧妙地融入游戏中。通…

重庆市建设工程造价站网站产品的详情页怎么做

文 | Alex(发自凹非寺)源 | 量子位出家十二载的北大数学天才柳智宇,如今下山还俗了。18岁时,他获得国际数学奥林匹克竞赛满分金牌,顺理成章地被保送到中国“第一学府第一系”:北京大学数学系。22岁,在获得MIT全额奖学金…

wordpress 做公司网站骑行网站模板

【README】 本文阐述了3种代理模式的定义,并编写了代码测试案例; 代理其实是一种设计模式,可以在访问目标对象的方法上下文添加处理逻辑(扩展目标对象的功能),是 切面编程的基石; 【举个例子】…

个人网站建设知乎新手学做网站从哪里开始

在进一步讨论之前,我们需要解释什么是 javascript 运行时以及为什么我们应该关心它的速度。 想象一下,你用JavaScript写了一个故事,你需要有人大声朗读。JavaScript 运行时就像那个友好的叙述者,让你的故事栩栩如生!这…

网站建设涉及的法律做网站制作较好的公司

高斯滤波 高斯滤波是一种线性平滑滤波,适用于消除高斯噪声,广泛应用于图像处理的减噪过程。通俗的讲,高斯滤波就是对整幅图像进行加权平均的过程,每一个像素点的值,都由其本身和邻域内的其他像素值经过加权平均后得到…

取消网站的通知书网络营销外包公司哪家好

来源:中国华能(部分内容参考《财经》杂志韩舒淋“从GE数字化业务大调整看工业互联网未来”)打响“工业互联网”第一枪的GE(美国通用电气),曾是全球市值最高的工业巨头,如今市值却缩水至巅峰时期…

iis 浏览网站鹤壁建设网站推广渠道

目录 一、前言二、登录torna三、创建/选择空间四、创建/选择项目五、创建/选择应用六、获取应用的token七、服务推送7.1 引入maven依赖7.2 test下面按照如下方式新建文件 一、前言 Torna作为一款企业级文档管理系统,支持了很多种接口文档的推送方式。官方比较推荐的…

自己做网站送外卖襄阳网站seo

本文介绍使用python提取pdf中的表格到excel中,包含pdf的拆分、pdf提取到excel、合并excel。 一、拆分pdf 将一个大的pdf按页数拆分为多个小的pdf: # pip install PyPDF2import os, pdfplumber, PyPDF2# 分割pdf def split_pdf(input_pdf_path, num_splits):# Create a PDF…

江阴做网站的公司有国内平台有哪些

网络基本协议 TCP协议 UDP协议 二者对比: 连接性: TCP是面向连接的协议,需要在传输数据之前先进行三次握手建立连接。而UDP是无连接的协议,可以直接发送数据,无需事先建立连接。 可靠性: TCP提供了数…

电影网站推广3d效果图设计制作软件

mysql如何删除一条记录delete from 表名 where 条件实例:use db1delete from tb1 where id 1; 转载于:https://www.cnblogs.com/effortsing/p/10393229.html

仓山福州网站建设做soho外贸网站

转载:http://www.cnblogs.com/lijunamneg/archive/2013/01/18/2866953.html Android其本质就是在标准的Linux系统上增加了Java虚拟机Dalvik,并在Dalvik虚拟机上搭建了一个JAVA的application framework,所有的应用程序都是基于JAVA的applicati…

中国住房和城乡建设网网站湛江免费网站建站模板

腾讯云免费服务器申请入口 https://curl.qcloud.com/FJhqoVDP 免费服务器可选轻量应用服务器和云服务器CVM,轻量配置可选2核2G3M、2核8G7M和4核8G12M,CVM云服务器可选2核2G3M和2核4G3M配置,腾讯云服务器网txyfwq.com分享2024年最新腾讯云免费…

域名网站网址宜昌市上海中学官网

受到其它一些函数式编程开发语言的影响,在Erlang语言中,将函数作为一个对象,赋予其“变量”的属性,即为我们的匿名函数 或 简称 fun,它具有以下特性: (匿名函数:不是定义在Erlang模…

做会员卡网站百度广告联盟推广链接

一、Q-learning算法介绍 Q-learning是一种强化学习算法,用于解决基于环境的决策问题。它通过学习一个Q-table来指导智能体在不同状态下采取最优动作。下面是Q-learning算法的基本步骤: 1. 定义环境:确定问题的状态和动作空间,并…

网站开发好百度一下百度百科

基于协同过滤算法的推荐 (本实验选用数据为真实电商脱敏数据,仅用于学习,请勿商用) 数据挖掘的一个经典案例就是尿布与啤酒的例子。尿布与啤酒看似毫不相关的两种产品,但是当超市将两种产品放到相邻货架销售的时候&a…

做网站的公司不给域名做网站需要掌握什么

数学基础线性代数 从行的角度从列的角度行列式的几何解释向量范数和矩阵范数 向量范数矩阵范数的更强的性质的意义 几种向量范数诱导的矩阵范数 1 范数诱导的矩阵范数无穷范数诱导的矩阵范数2 范数诱导的矩阵范数 各种范数之间的等价性向量与矩阵序列的收敛性 函数的可微性与展…