一个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:外部存储器…...
Java 语言特性(面试系列1)
一、面向对象编程 1. 封装(Encapsulation) 定义:将数据(属性)和操作数据的方法绑定在一起,通过访问控制符(private、protected、public)隐藏内部实现细节。示例: public …...
2025年能源电力系统与流体力学国际会议 (EPSFD 2025)
2025年能源电力系统与流体力学国际会议(EPSFD 2025)将于本年度在美丽的杭州盛大召开。作为全球能源、电力系统以及流体力学领域的顶级盛会,EPSFD 2025旨在为来自世界各地的科学家、工程师和研究人员提供一个展示最新研究成果、分享实践经验及…...
vue3 定时器-定义全局方法 vue+ts
1.创建ts文件 路径:src/utils/timer.ts 完整代码: import { onUnmounted } from vuetype TimerCallback (...args: any[]) > voidexport function useGlobalTimer() {const timers: Map<number, NodeJS.Timeout> new Map()// 创建定时器con…...
什么是EULA和DPA
文章目录 EULA(End User License Agreement)DPA(Data Protection Agreement)一、定义与背景二、核心内容三、法律效力与责任四、实际应用与意义 EULA(End User License Agreement) 定义: EULA即…...
解决本地部署 SmolVLM2 大语言模型运行 flash-attn 报错
出现的问题 安装 flash-attn 会一直卡在 build 那一步或者运行报错 解决办法 是因为你安装的 flash-attn 版本没有对应上,所以报错,到 https://github.com/Dao-AILab/flash-attention/releases 下载对应版本,cu、torch、cp 的版本一定要对…...
GC1808高性能24位立体声音频ADC芯片解析
1. 芯片概述 GC1808是一款24位立体声音频模数转换器(ADC),支持8kHz~96kHz采样率,集成Δ-Σ调制器、数字抗混叠滤波器和高通滤波器,适用于高保真音频采集场景。 2. 核心特性 高精度:24位分辨率,…...
稳定币的深度剖析与展望
一、引言 在当今数字化浪潮席卷全球的时代,加密货币作为一种新兴的金融现象,正以前所未有的速度改变着我们对传统货币和金融体系的认知。然而,加密货币市场的高度波动性却成为了其广泛应用和普及的一大障碍。在这样的背景下,稳定…...
使用LangGraph和LangSmith构建多智能体人工智能系统
现在,通过组合几个较小的子智能体来创建一个强大的人工智能智能体正成为一种趋势。但这也带来了一些挑战,比如减少幻觉、管理对话流程、在测试期间留意智能体的工作方式、允许人工介入以及评估其性能。你需要进行大量的反复试验。 在这篇博客〔原作者&a…...
MySQL 部分重点知识篇
一、数据库对象 1. 主键 定义 :主键是用于唯一标识表中每一行记录的字段或字段组合。它具有唯一性和非空性特点。 作用 :确保数据的完整性,便于数据的查询和管理。 示例 :在学生信息表中,学号可以作为主键ÿ…...
rknn toolkit2搭建和推理
安装Miniconda Miniconda - Anaconda Miniconda 选择一个 新的 版本 ,不用和RKNN的python版本保持一致 使用 ./xxx.sh进行安装 下面配置一下载源 # 清华大学源(最常用) conda config --add channels https://mirrors.tuna.tsinghua.edu.cn…...
