一个spring boot项目的启动过程分析
1、web.xml 定义入口类
<context-param><param-name>contextConfigLocation</param-name><param-value>com.baosight.ApplicationBoot</param-value>
</context-param>
2、主入口类: ApplicationBoot,SpringBoot项目的mian函数
@SpringBootApplication(scanBasePackages = "com.bs")
@ServletComponentScan("com.bs.4j.core.web.servlet")
@ImportResource(locations = {"classpath*:spring/framework/platApplicationContext*.xml", "classpath*:spring/framework/applicationContext*.xml"})
@EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class})
public class ApplicationBoot extends SpringBootServletInitializer {public static void main(String[] args) {SpringApplication app = new SpringApplication(ApplicationBoot.class);app.run(args);}@Overrideprotected SpringApplicationBuilder configure(SpringApplicationBuilder application) {return application.sources(ApplicationBoot.class);}}
3、SpringApplication
SpringApplication类是Spring Boot框架的核心组件之一,它负责整个应用的启动和初始化过程。SpringApplication的设计目标是简化Spring应用的启动步骤,提供一套开箱即用的配置,让开发者能够快速启动和运行Spring应用。
在这个类中:
3.1、SpringApplication构造方法
/*** Create a new {@link SpringApplication} instance. The application context will load* beans from the specified primary sources (see {@link SpringApplication class-level}* documentation for details. The instance can be customized before calling* {@link #run(String...)}.* @param primarySources the primary bean sources* @see #run(Class, String[])* @see #SpringApplication(ResourceLoader, Class...)* @see #setSources(Set)*/public SpringApplication(Class<?>... primarySources) {this(null, primarySources);}/*** Create a new {@link SpringApplication} instance. The application context will load* beans from the specified primary sources (see {@link SpringApplication class-level}* documentation for details. The instance can be customized before calling* {@link #run(String...)}.* @param resourceLoader the resource loader to use* @param primarySources the primary bean sources* @see #run(Class, String[])* @see #setSources(Set)*/@SuppressWarnings({ "unchecked", "rawtypes" })public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) {this.resourceLoader = resourceLoader;Assert.notNull(primarySources, "PrimarySources must not be null");this.primarySources = new LinkedHashSet<>(Arrays.asList(primarySources));this.webApplicationType = WebApplicationType.deduceFromClasspath();setInitializers((Collection) getSpringFactoriesInstances(ApplicationContextInitializer.class));setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class));this.mainApplicationClass = deduceMainApplicationClass();}
对于构造函数的解读
-
参数初始化:
resourceLoader:这是一个资源加载器,用于从类路径或其他位置加载资源,如配置文件、静态资源等。primarySources:这是应用程序的主要配置源,通常是一个或多个配置类的数组,用于引导Spring的自动配置和组件扫描。
-
非空检查:
- 对
primarySources进行非空检查,确保至少有一个配置源被提供,否则将抛出IllegalArgumentException。
- 对
-
配置源存储:
- 将
primarySources转换为LinkedHashSet集合并存储,保持插入顺序,这有助于后续的配置解析和组件扫描。
- 将
-
Web应用类型推断:
- 调用
WebApplicationType.deduceFromClasspath()方法自动检测应用的Web类型,是Servlet-based、Reactive-based还是None(非Web应用)。这一决策影响了Spring Boot如何初始化Web环境。
- 调用
-
ApplicationContext Initializers设置:
- 调用
getSpringFactoriesInstances方法来获取所有实现了ApplicationContextInitializer接口的实例,并将其设置为SpringApplication的initializers。这些initializers会在ApplicationContext创建过程中被调用,用于自定义上下文的初始化。
- 调用
-
Application Listeners设置:
- 同样地,通过
getSpringFactoriesInstances方法获取所有实现了ApplicationListener接口的实例,并将其设置为SpringApplication的listeners。这些listeners会在应用生命周期的不同阶段被触发,如启动、停止等。
- 同样地,通过
-
主应用类推断:
- 调用
deduceMainApplicationClass方法来确定应用的主类,通常是启动应用的那个类,用于在某些情况下(如生成文档)标识应用本身。
- 调用
3.1.1、WebApplicationType.deduceFromClasspath()
检测应用的Web类型,在下文ConfigurableApplicationContext的实例化中会使用到
3.1.2、setInitializers
初始化classpath下 META-INF/spring.factories中已配置的ApplicationContextInitializer
private <T> Collection<T> getSpringFactoriesInstances(Class<T> type) {return getSpringFactoriesInstances(type, new Class<?>[] {});}private <T> Collection<T> getSpringFactoriesInstances(Class<T> type,Class<?>[] parameterTypes, Object... args) {ClassLoader classLoader = getClassLoader();// Use names and ensure unique to protect against duplicatesSet<String> names = new LinkedHashSet<>(SpringFactoriesLoader.loadFactoryNames(type, classLoader));List<T> instances = createSpringFactoriesInstances(type, parameterTypes,classLoader, args, names);AnnotationAwareOrderComparator.sort(instances);return instances;}
1、getSpringFactoriesInstances有什么用,做了什么,这个方法是根据给定的类型type和ClassLoader,从spring-core提供的FACTORIES_RESOURCE_LOCATION=META-INF/spring.factories文件中加载所有该类型的工厂类名,即获取指定的类(key)的同一入口方法。这里使用了LinkedHashSet来存储这些名字,确保它们是唯一的且按插入顺序排序。这一块在SpringFactoriesLoader.loadFactoryNames/loadSpringFactories中实现
public static List<String> loadFactoryNames(Class<?> factoryClass, @Nullable ClassLoader classLoader) {String factoryClassName = factoryClass.getName();return loadSpringFactories(classLoader).getOrDefault(factoryClassName, Collections.emptyList());}private static Map<String, List<String>> loadSpringFactories(@Nullable ClassLoader classLoader) {MultiValueMap<String, String> result = cache.get(classLoader);if (result != null) {return result;}try {Enumeration<URL> urls = (classLoader != null ?classLoader.getResources(FACTORIES_RESOURCE_LOCATION) :ClassLoader.getSystemResources(FACTORIES_RESOURCE_LOCATION));result = new LinkedMultiValueMap<>();while (urls.hasMoreElements()) {URL url = urls.nextElement();UrlResource resource = new UrlResource(url);Properties properties = PropertiesLoaderUtils.loadProperties(resource);for (Map.Entry<?, ?> entry : properties.entrySet()) {String factoryClassName = ((String) entry.getKey()).trim();for (String factoryName : StringUtils.commaDelimitedListToStringArray((String) entry.getValue())) {result.add(factoryClassName, factoryName.trim());}}}cache.put(classLoader, result);return result;}catch (IOException ex) {throw new IllegalArgumentException("Unable to load factories from location [" +FACTORIES_RESOURCE_LOCATION + "]", ex);}}
在这里,获取的是key为 org.springframework.context.ApplicationContextInitializer 的类。ApplicationContextInitializer 是Spring框架的类, 这个类的主要目的就是在 ConfigurableApplicationContext 调用refresh()方法之前,回调这个类的initialize方法。通过 ConfigurableApplicationContext 的实例获取容器的环境Environment,从而实现对配置文件的修改完善等工作。
3.1.3 、setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class));
ApplicationListener 的加载过程和上面的 ApplicationContextInitializer 类的加载过程是一样的.ApplicationListener 是spring的事件监听器,典型的观察者模式,通过 ApplicationEvent 类和 ApplicationListener 接口,可以实现对spring容器全生命周期的监听
SpringApplication 类的实例化过程,我们可以在spring容器创建之前做一些预备工作,和定制化的需求。比如,自定义SpringBoot的Banner,比如自定义事件监听器,再比如在容器refresh之前通过自定义 ApplicationContextInitializer 修改配置一些配置或者获取指定的bean都是可以的
3.2、SpringApplication.run()
如下面代码所示
/*** Run the Spring application, creating and refreshing a new* {@link ApplicationContext}.* @param args the application arguments (usually passed from a Java main method)* @return a running {@link ApplicationContext}*/
public ConfigurableApplicationContext run(String... args) {StopWatch stopWatch = new StopWatch();stopWatch.start();ConfigurableApplicationContext context = null;Collection<SpringBootExceptionReporter> exceptionReporters = new ArrayList<>();configureHeadlessProperty();SpringApplicationRunListeners listeners = getRunListeners(args);listeners.starting();try {ApplicationArguments applicationArguments = new DefaultApplicationArguments(args);ConfigurableEnvironment environment = prepareEnvironment(listeners,applicationArguments);configureIgnoreBeanInfo(environment);Banner printedBanner = printBanner(environment);context = createApplicationContext();exceptionReporters = getSpringFactoriesInstances(SpringBootExceptionReporter.class,new Class[] { ConfigurableApplicationContext.class }, context);prepareContext(context, environment, listeners, applicationArguments,printedBanner);refreshContext(context);afterRefresh(context, applicationArguments);stopWatch.stop();if (this.logStartupInfo) {new StartupInfoLogger(this.mainApplicationClass).logStarted(getApplicationLog(), stopWatch);}listeners.started(context);callRunners(context, applicationArguments);}catch (Throwable ex) {handleRunFailure(context, ex, exceptionReporters, listeners);throw new IllegalStateException(ex);}try {listeners.running(context);}catch (Throwable ex) {handleRunFailure(context, ex, exceptionReporters, null);throw new IllegalStateException(ex);}return context;
}
run方法详解:
-
计时和异常处理设置:
-
创建一个
StopWatch对象来测量应用启动所需的时间。 -
初始化一个空列表
exceptionReporters,用于存放异常报告器。
-
-
配置无头模式:
-
调用
configureHeadlessProperty方法确保应用在没有图形界面的环境中也能运行。
-
-
监听器初始化:
-
获取
SpringApplicationRunListeners监听器实例,并调用starting方法通知监听器应用即将开始启动。
-
-
解析命令行参数:
-
创建
ApplicationArguments实例,用于解析传入的命令行参数。
-
-
环境准备:
-
准备
ConfigurableEnvironment环境,这个环境包含了应用的配置信息。应用上下文环境包括什么呢?包括计算机的环境,Java环境,Spring的运行环境,Spring项目的配置(在SpringBoot中就是那个熟悉的application.properties/yml)等等。
-
-
忽略Bean信息配置:
-
调用
configureIgnoreBeanInfo方法,这通常用于性能优化,避免加载不必要的Bean信息。
-
-
打印Banner:
-
打印应用的启动Banner,显示应用名、版本等信息。
-
-
创建ApplicationContext:
-
创建
ConfigurableApplicationContext上下文,这是Spring管理Bean的容器。
-
-
异常报告器获取:
-
通过
getSpringFactoriesInstances方法获取所有SpringBootExceptionReporter实例。
-
-
上下文准备:
-
调用
prepareContext方法进行上下文的准备工作,包括注册Bean后处理器、监听器等。
-
-
刷新上下文:
-
调用
refreshContext方法刷新上下文,这是Spring Bean生命周期的关键点。
-
-
启动后操作:
-
调用
afterRefresh方法执行一些应用启动后的操作,如初始化定时任务等。
-
-
日志记录:
-
如果配置了记录启动信息,使用
StartupInfoLogger记录应用启动完成的日志。
-
-
监听器回调:
-
通知监听器应用已经启动。
-
-
运行Runners:
-
调用
callRunners方法执行定义好的ApplicationRunner或CommandLineRunner,它们通常用于执行一些启动后的初始化工作。
-
-
异常处理:
-
在整个启动过程中捕获并处理可能发生的异常,确保应用能够优雅地处理错误。
-
-
返回ApplicationContext:
-
最终返回创建的
ConfigurableApplicationContext实例,这是Spring Boot应用的核心组件。
-
3.3、ConfigurableApplicationContext
ConfigurableApplicationContext是Spring框架中ApplicationContext接口的一个扩展,它提供了更多的配置和控制能力,是Spring应用程序上下文的高级接口。在Spring Boot中,ConfigurableApplicationContext扮演着核心角色,用于管理应用程序的生命周期和Bean的配置。下面是一些关键特性及其作用的详细解读:
配置和定制
ConfigurableApplicationContext允许开发者在应用程序启动时对上下文进行更深入的定制,例如设置Environment、ResourceLoader、MessageSource、ApplicationEventPublisher等。这使得你可以更灵活地调整Spring容器的行为,以适应不同的应用场景。
刷新上下文
与ApplicationContext不同的是,ConfigurableApplicationContext提供了refresh()方法,用于手动刷新上下文,重新加载配置并初始化Bean。这是非常有用的,特别是在测试场景中,你需要在每次测试之前重置Spring上下文的状态。
关闭上下文
ConfigurableApplicationContext提供了close()方法,允许你优雅地关闭上下文,释放资源。这对于那些不需要一直运行的应用程序尤其重要,比如批处理作业或命令行应用。
监听器支持
它支持ApplicationListener,允许你在上下文的生命周期事件(如启动、关闭、Bean实例化等)中注册监听器,以便于执行自定义逻辑。这对于集成日志记录、健康检查等功能非常有用。
环境感知
ConfigurableApplicationContext允许你访问和修改应用的Environment,这包括读取和设置配置属性、切换不同的配置文件(profiles)等。这对于多环境部署(如开发、测试、生产)的管理至关重要。
事件发布
除了标准的ApplicationEventPublisher功能,ConfigurableApplicationContext还提供了更细粒度的事件发布和监听机制,这对于实现复杂的业务逻辑和系统集成非常有帮助。
实例化
在Spring Boot中,SpringApplication的run方法通过createApplicationContext返回一个ConfigurableApplicationContext实例,这通常是应用程序的主要入口点,可以通过这个上下文访问到所有由Spring管理的Bean和资源。下面则是createApplicationContext的具体实现:
Strategy method used to create the ApplicationContext. By default this method will respect any explicitly set application context or application context class before falling back to a suitable default.
返回值:
the application context (not yet refreshed)
请参阅:
setApplicationContextClass(Class)
protected ConfigurableApplicationContext createApplicationContext() {Class<?> contextClass = this.applicationContextClass;if (contextClass == null) {try {switch (this.webApplicationType) {case SERVLET:contextClass = Class.forName(DEFAULT_SERVLET_WEB_CONTEXT_CLASS);break;case REACTIVE:contextClass = Class.forName(DEFAULT_REACTIVE_WEB_CONTEXT_CLASS);break;default:contextClass = Class.forName(DEFAULT_CONTEXT_CLASS);}}catch (ClassNotFoundException ex) {throw new IllegalStateException("Unable create a default ApplicationContext, "+ "please specify an ApplicationContextClass",ex);}}return (ConfigurableApplicationContext) BeanUtils.instantiateClass(contextClass);}
3.2.1、WebApplicationType详解
WebApplicationType,一个枚举,且里面定义了三个枚举值,分别是 NONE、SERVLET、REACTIVE
SERVLET:传统的Servlet-based web应用,内嵌基于 servlet 的 web 服务器(如:Tomcat,Jetty,Undertow 等,其实现在大多Java网站应用都是采用的基于 Tomcat 的 servlet 类型服务器),默认使用AnnotationConfigServletWebServerApplicationContext作为上下文。
REACTIVE:响应式web应用,在 servlet 容器当中,采用命令式编程方式,代码一句一句的执行,这样更有利于理解与调试,而在反应式的 web 编程中,是基于异步响应式,现在 WebFlux 框架就是一个较为流行的反应式编程,默认使用AnnotationConfigReactiveWebServerApplicationContext作为上下文。
NONE:既不是SERVLET也不是REACTIVE:即非Web应用,非 web 应用程序(不内嵌服务器),则默认使用AnnotationConfigApplicationContext作为上下文。
而关于Springboot 如何确定程序的应用类型 WebApplicationType 的?
在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));this.webApplicationType = WebApplicationType.deduceFromClasspath();setInitializers((Collection) getSpringFactoriesInstances(ApplicationContextInitializer.class));setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class));this.mainApplicationClass = deduceMainApplicationClass();}
this.webApplicationType = WebApplicationType.deduceFromClasspath();其中 WebApplicationType.deduceFromClasspath() 这个方法实现如下
static WebApplicationType deduceFromClasspath() {if (ClassUtils.isPresent(WEBFLUX_INDICATOR_CLASS, null)&& !ClassUtils.isPresent(WEBMVC_INDICATOR_CLASS, null)&& !ClassUtils.isPresent(JERSEY_INDICATOR_CLASS, null)) {return WebApplicationType.REACTIVE;}for (String className : SERVLET_INDICATOR_CLASSES) {if (!ClassUtils.isPresent(className, null)) {return WebApplicationType.NONE;}}return WebApplicationType.SERVLET;}
ClassUtils.isPresent()?干什么的?用来判断一个类的存在性的,当这个类存在,那么返回的就是 true;当这个类不存在时,返回的结果就是 fasle。
(1)WEBFLUX_INDICATOR_CLASS,WEBMVC_INDICATOR_CLASS,JERSEY_INDICATOR_CLASS常量值又分别是什么?看源码
private static final String WEBMVC_INDICATOR_CLASS = "org.springframework."+ "web.servlet.DispatcherServlet";private static final String WEBFLUX_INDICATOR_CLASS = "org."+ "springframework.web.reactive.DispatcherHandler";private static final String JERSEY_INDICATOR_CLASS = "org.glassfish.jersey.servlet.ServletContainer";
当项目中存在 DispatcherHandler 这个类,且不存在 DispatcherServlet 类和ServletContainer时,程序的应用类型就是 REACTIVE,也就是他会加载嵌入一个反应式的 web 服务器。
(2)而SERVLET_INDICATOR_CLASSES
private static final String[] SERVLET_INDICATOR_CLASSES = { "javax.servlet.Servlet","org.springframework.web.context.ConfigurableWebApplicationContext" };
当项目中 Servlet 和 ConfigurableWebApplicationContext 其中一个不存在时,则程序的应用类型为 NONE,它并不会加载内嵌任何 web 服务器。
(3)除了上面两种情况外,其余的都按 SERVLET 类型处理,会内嵌一个 servlet 类型的 web 服务器
上面的这些类的判定,都来源于 Spring 的相关依赖包,而这依赖包是否需要导入,也是开发者所决定的,所以说开发者可以决定程序的应用类型,并不是 Srpingboot 本身决定的。

3.4、refreshContext
相关文章:
一个spring boot项目的启动过程分析
1、web.xml 定义入口类 <context-param><param-name>contextConfigLocation</param-name><param-value>com.baosight.ApplicationBoot</param-value> </context-param> 2、主入口类: ApplicationBoot,SpringBoot项目的mian函数 SpringBo…...
智驭未来:人工智能与目标检测的深度交融
在科技日新月异的今天,人工智能(AI)如同一股不可阻挡的浪潮,正以前所未有的速度重塑着我们的世界。在众多AI应用领域中,目标检测以其独特的魅力和广泛的应用前景,成为了连接现实与智能世界的桥梁。本文旨在…...
01MFC建立单个文件类型——画线
文章目录 选择模式初始化文件作用解析各初始化文件解析 类导向创建鼠标按键按下抬起操作函数添加一个变量记录起始位置注意事项代码实现效果图 虚实/颜色线 选择模式 初始化文件作用解析 运行: 各初始化文件解析 MFC(Microsoft Foundation Classes&am…...
免杀中用到的工具
🟢 绝大部分无法直接生成免杀木马,开发、测试免杀时会用到。 工具简称 概述 工具来源 下载路径 x64dbg 中文版安装程序(Jan 6 2024).exe 52pojie hellshell 官方的加密或混淆shellcode github Releases ORCA / HellShell GitLab hellshe…...
[vite] Pre-transform error: Cannot find package pnpm路径过长导致运行报错
下了套vue3的代码,执行pnpm install初始化,使用vite启动,启动后访问就会报错 报错信息 ERROR 16:40:53 [vite] Pre-transform error: Cannot find package E:\work\VSCodeProjectWork\jeecg\xxxxxxxxx-next\xxxxxxxxx-next-jeecgBoot-vue3\…...
Promise总结
Promise.then() 的返回值仍然是 Promise 对象 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8" /><meta name"viewport" content"widthdevice-width, initial-scale1.0" /><title>D…...
ROI 接口便捷修改
传入的图片截取ROI后再进入识别接口 (识别接口比ROI接口的函数参数少一个传入的ROI) 无点只有点集 返回双点集 //平直冷侧翅片 bool ImageProcessingTest::straightColdSideFin_ROI(cv::Mat img, cv::Rect ROI, std::vector<cv::Point>& topL…...
jenkins打包java项目报错Error: Unable to access jarfile tlm-admin.jar
jenkins打包boot项目 自动重启脚本失败 查看了一下项目日志报错: Error: Unable to access jarfile tlm-admin.jar我检查了一下这个配置,感觉没有问题,包可以正常打, cd 到项目目录下面,手动执行这个sh脚本也是能正常…...
SQL Server设置端口:跨平台指南
在使用SQL Server时,设置或修改其监听的端口是确保数据库服务安全访问和高效管理的重要步骤。由于SQL Server可以部署在多种操作系统上,包括Windows、Linux和Docker容器等,因此设置端口的步骤和方法也会因平台而异。本文将为您提供一个跨平台…...
ActiveMQ-CVE-2023-46604
Apache ActiveMQ OpenWire 协议反序列化命令执行漏洞 OpenWire协议在ActiveMQ中被用于多语言客户端与服务端通信。在Apache ActvieMQ5.18.2版本以及以前,OpenWire协议通信过程中存在一处反序列化漏洞,该漏洞可以允许具有网络访问权限的远程攻击者通过操作…...
TensorBoard ,PIL 和 OpenCV 在深度学习中的应用
重要工具介绍 TensorBoard: 是一个TensorFlow提供的强大工具,用于可视化和理解深度学习模型的训练过程和结果。下面我将介绍TensorBoard的相关知识和使用方法。 TensorBoard 简介 TensorBoard是TensorFlow提供的一个可视化工具,用于&#x…...
【超音速 专利 CN117576413A】基于全连接网络分类模型的AI涂布抓边处理方法及系统
申请号CN202311568976.4公开号(公开)CN117576413A申请日2023.11.22申请人(公开)超音速人工智能科技股份有限公司发明人(公开)张俊峰(总); 杨培文(总); 沈俊羽…...
iPhone数据恢复篇:iPhone 数据恢复软件有哪些
问题:iPhone 15 最好的免费恢复软件是什么?我一直在寻找一个恢复程序来恢复从iPhone中意外删除的照片,联系人和消息,但是我有很多选择。 谷歌一下,你会发现许多付费或免费的iPhone数据恢复工具,声称它们可…...
Html5+Css3学习笔记
Html5 CSS3 一、概念 1.什么是html5 html: Hyper Text Markup Language ( 超文本标记语言) 文本:记事本 超文本: 文字、图片、音频、视频、动画等等(网页) html语言经过浏览器的编译显示成超文本 开发者使用5种浏览器…...
WPF学习(2) -- 样式基础
一、代码 <Window x:Class"学习.MainWindow"xmlns"http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x"http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d"http://schemas.microsoft.com/expression/blend/2008&…...
独家揭秘!五大内网穿透神器,访问你的私有服务
本文精心筛选了五款炙手可热的内网穿透工具,它们各怀绝技,无论您是企业用户、独立开发者,还是技术探索者,这篇文章都物有所值,废话不多说,主角们即将上场。 目录 1. 巴比达 - 安全至上的企业护航者 2. 花…...
Ubuntu 编译和运行ZLMediaKit
摘要 本文描述了如何在Ubuntu上构建ZLMediaKIt项目源码,以及如何体验其WebRTC推流和播放功能。 实验环境 操作系统版本:Ubuntu 22.04.3 LTS gcc版本:11.4.0 g版本:11.4.0 依赖库安装 #让ZLMediaKit媒体服务器具备WebRTC流转发…...
基于JavaSpringBoot+Vue+uniapp微信小程序校园宿舍管理系统设计与实现
基于JavaSpringBootVueuniapp微信小程序实现校园宿舍管理系统设计与实现 目录 第一章 绪论 1.1 研究背景 1.2 研究现状 1.3 研究内容 第二章 相关技术介绍 2.1 Java语言 2.2 HTML网页技术 2.3 MySQL数据库 2.4 Springboot 框架介绍 2.5 VueJS介绍 2.6 ElementUI介绍…...
Hive的基本操作(创建与修改)
必备知识 数据类型 基本类型 类型写法字符char, varchar, string✔整数tinyint, smallint, int✔, bigint✔小数float, double, numeric(m,n), decimal(m,n)✔布尔值boolean✔时间date✔, timestamp✔ 复杂类型(集合类型) 1、数组:array<T> 面向用户提供…...
Linux开发讲课37--- ARM的22个常用概念
1. ARM中一些常见英文缩写解释 MSB:最高有效位; LSB:最低有效位; AHB:先进的高性能总线; VPB:连接片内外设功能的VLSI外设总线; EMC:外部存储器…...
MPNet:旋转机械轻量化故障诊断模型详解python代码复现
目录 一、问题背景与挑战 二、MPNet核心架构 2.1 多分支特征融合模块(MBFM) 2.2 残差注意力金字塔模块(RAPM) 2.2.1 空间金字塔注意力(SPA) 2.2.2 金字塔残差块(PRBlock) 2.3 分类器设计 三、关键技术突破 3.1 多尺度特征融合 3.2 轻量化设计策略 3.3 抗噪声…...
调用支付宝接口响应40004 SYSTEM_ERROR问题排查
在对接支付宝API的时候,遇到了一些问题,记录一下排查过程。 Body:{"datadigital_fincloud_generalsaas_face_certify_initialize_response":{"msg":"Business Failed","code":"40004","sub_msg…...
MongoDB学习和应用(高效的非关系型数据库)
一丶 MongoDB简介 对于社交类软件的功能,我们需要对它的功能特点进行分析: 数据量会随着用户数增大而增大读多写少价值较低非好友看不到其动态信息地理位置的查询… 针对以上特点进行分析各大存储工具: mysql:关系型数据库&am…...
8k长序列建模,蛋白质语言模型Prot42仅利用目标蛋白序列即可生成高亲和力结合剂
蛋白质结合剂(如抗体、抑制肽)在疾病诊断、成像分析及靶向药物递送等关键场景中发挥着不可替代的作用。传统上,高特异性蛋白质结合剂的开发高度依赖噬菌体展示、定向进化等实验技术,但这类方法普遍面临资源消耗巨大、研发周期冗长…...
深入浅出:JavaScript 中的 `window.crypto.getRandomValues()` 方法
深入浅出:JavaScript 中的 window.crypto.getRandomValues() 方法 在现代 Web 开发中,随机数的生成看似简单,却隐藏着许多玄机。无论是生成密码、加密密钥,还是创建安全令牌,随机数的质量直接关系到系统的安全性。Jav…...
C++中string流知识详解和示例
一、概览与类体系 C 提供三种基于内存字符串的流,定义在 <sstream> 中: std::istringstream:输入流,从已有字符串中读取并解析。std::ostringstream:输出流,向内部缓冲区写入内容,最终取…...
HTML前端开发:JavaScript 常用事件详解
作为前端开发的核心,JavaScript 事件是用户与网页交互的基础。以下是常见事件的详细说明和用法示例: 1. onclick - 点击事件 当元素被单击时触发(左键点击) button.onclick function() {alert("按钮被点击了!&…...
pikachu靶场通关笔记22-1 SQL注入05-1-insert注入(报错法)
目录 一、SQL注入 二、insert注入 三、报错型注入 四、updatexml函数 五、源码审计 六、insert渗透实战 1、渗透准备 2、获取数据库名database 3、获取表名table 4、获取列名column 5、获取字段 本系列为通过《pikachu靶场通关笔记》的SQL注入关卡(共10关࿰…...
嵌入式常见 CPU 架构
架构类型架构厂商芯片厂商典型芯片特点与应用场景PICRISC (8/16 位)MicrochipMicrochipPIC16F877A、PIC18F4550简化指令集,单周期执行;低功耗、CIP 独立外设;用于家电、小电机控制、安防面板等嵌入式场景8051CISC (8 位)Intel(原始…...
图解JavaScript原型:原型链及其分析 | JavaScript图解
忽略该图的细节(如内存地址值没有用二进制) 以下是对该图进一步的理解和总结 1. JS 对象概念的辨析 对象是什么:保存在堆中一块区域,同时在栈中有一块区域保存其在堆中的地址(也就是我们通常说的该变量指向谁&…...
