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

SpringBoot 源码分析初始化应用上下文(1)-createApplicationContext

前言:springBoot的版本是  2.2.4.RELEASE

一、入口

/*** 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;}

问题切入:为什么叫做上下文对象呢?上下文对象,就是当前应用环境下的一个集合

初始化(创建)上下文对象主要看上面注释那行,即:

context = createApplicationContext();

接着看下 createApplicationContext() 这个方法的实现

截图:

代码:

/*** Strategy method used to create the {@link ApplicationContext}. By default this* method will respect any explicitly set application context or application context* class before falling back to a suitable default.* @return the application context (not yet refreshed)* @see #setApplicationContextClass(Class)*/protected ConfigurableApplicationContext createApplicationContext() {Class<?> contextClass = this.applicationContextClass;if (contextClass == null) {try {switch (this.webApplicationType) {case SERVLET:// 创建上下文对象 AnnotationConfigServletWebServerApplicationContext 进行实例化的过程中,此时 ioc 容器也会被创建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);}}//创建 AnnotationConfigServletWebServerApplicationContext 对象的无参构造return (ConfigurableApplicationContext) BeanUtils.instantiateClass(contextClass);}

 接着看下AnnotationConfigServletWebServerApplicationContext 这个对象的继承关系

 从继承关系上面看继承关系比较深,同时可以看到 GenericApplicationContext(通用上下文对象),上面实例化AnnotationConfigServletWebServerApplicationContext的时候就是从该对象的无参构造方法开始的,我们就从AnnotationConfigServletWebServerApplicationContext对象的无参构造方法从代码上面看一下代码逻辑,注意:子类实例化的时候先实例化父类的构造方法

截图如下:

 1、AnnotationConfigServletWebServerApplicationContext 的无参构造【注解配置Servlet Web服务器应用程序上下文】

2、ServletWebServerApplicationContext 的无参构造【Servlet Web服务器应用程序上下文】

==> 这一步啥事没做

 3、GenericWebApplicationContext 的无参构造【通用Web应用程序上下文】

==> 这个方法实例化的时候继承了父类

 4、GenericApplicationContext 的无参构造【通用应用程序上下文】

 ==> 这里直接new一个 DefaultListableBeanFactory 对象,这个对象就是IOC容器最开始的样子,

这里其实是已经创建了 bean 工厂, DefaultListableBeanFactory 这个类里面有一个beanDefinitionMap,就是用来存放bean对象的。

二、AnnotationConfigServletWebServerApplicationContext 无参构造的两个重要方法

截图:

代码:

/*** Create a new {@link AnnotationConfigServletWebServerApplicationContext} that needs* to be populated through {@link #register} calls and then manually* {@linkplain #refresh refreshed}.*/public AnnotationConfigServletWebServerApplicationContext() {//创建一个读取注解的Bean定义读取器//什么是 Bean 定义?BeanDefinition 完成了 spring 内部 Bean 的 BeanDefinition 的注册(主要是后置处理器)this.reader = new AnnotatedBeanDefinitionReader(this);//创建 BeanDefinition 扫描器,可以用来扫描包或者类,继而转换为 bd,//spring 默认的扫描器其实不是这个 scanner 对象,而是在后面自己又重新 new 了一个 ClassPathBeanDefinitionScanner //spring 在执行工程后置器 ConfigurationClassPostProcessor 时,去扫描包时会 new//这里 scanner 仅仅是为了 程序员可以手动调用 AnnotationConfigApplicationContext 对象的 scanner方法this.scanner = new ClassPathBeanDefinitionScanner(this);}

2.1 AnnotatedBeanDefinitionReader 构造方法

在看这个方法之前,我们先打个断点,然后看下this里面的 beanDefinitionMap 里面是否有有值,即IOC容器中是否有bean对象,可以看到,到这一步还是没有值的,即还没有bean实例存在IOC容器中。接着我们继续跑下一步

到这一步的时候可以看到  beanDefinitionMap 已经有bean存进去了,接下来我们重点看下

AnnotatedBeanDefinitionReader 构造方法 都做了哪些事情。

 AnnotatedBeanDefinitionReader 构造方法

截图:

接着看其有参构造方法

截图:

代码:

/*** Create a new {@code AnnotatedBeanDefinitionReader} for the given registry,* using the given {@link Environment}.* @param registry the {@code BeanFactory} to load bean definitions into,* in the form of a {@code BeanDefinitionRegistry}* @param environment the {@code Environment} to use when evaluating bean definition* profiles.* @since 3.1*/public AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry, Environment environment) {Assert.notNull(registry, "BeanDefinitionRegistry must not be null");Assert.notNull(environment, "Environment must not be null");this.registry = registry;this.conditionEvaluator = new ConditionEvaluator(registry, environment, null);//根据名字顾名思义就是注册注解配置的处理器//也就是这个方法里面会注册一些用于处理注解的处理器AnnotationConfigUtils.registerAnnotationConfigProcessors(this.registry);}

 接着看 registerAnnotationConfigProcessors 这个方法

继续看 registerAnnotationConfigProcessors 方法

截图:

代码:

	/*** Register all relevant annotation post processors in the given registry.* @param registry the registry to operate on* @param source the configuration source element (already extracted)* that this registration was triggered from. May be {@code null}.* @return a Set of BeanDefinitionHolders, containing all bean definitions* that have actually been registered by this call*/public static Set<BeanDefinitionHolder> registerAnnotationConfigProcessors(BeanDefinitionRegistry registry, @Nullable Object source) {//unwrap 打开...的包装,这里即获取默认bean工厂对象DefaultListableBeanFactory beanFactory = unwrapDefaultListableBeanFactory(registry);if (beanFactory != null) {if (!(beanFactory.getDependencyComparator() instanceof AnnotationAwareOrderComparator)) {//主要解析 @Order 和 @Priority	beanFactory.setDependencyComparator(AnnotationAwareOrderComparator.INSTANCE);}if (!(beanFactory.getAutowireCandidateResolver() instanceof ContextAnnotationAutowireCandidateResolver)) {//提供处理延迟加载的功能beanFactory.setAutowireCandidateResolver(new ContextAnnotationAutowireCandidateResolver());}}Set<BeanDefinitionHolder> beanDefs = new LinkedHashSet<>(8);//spring 默认 BeanDefinition 的注册if (!registry.containsBeanDefinition(CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME)) {RootBeanDefinition def = new RootBeanDefinition(ConfigurationClassPostProcessor.class);def.setSource(source);beanDefs.add(registerPostProcessor(registry, def, CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME));}//注册 AutowiredAnnotationBeanPostProcessorif (!registry.containsBeanDefinition(AUTOWIRED_ANNOTATION_PROCESSOR_BEAN_NAME)) {RootBeanDefinition def = new RootBeanDefinition(AutowiredAnnotationBeanPostProcessor.class);def.setSource(source);beanDefs.add(registerPostProcessor(registry, def, AUTOWIRED_ANNOTATION_PROCESSOR_BEAN_NAME));}//注册 CommonAnnotationBeanPostProcessor// Check for JSR-250 support, and if present add the CommonAnnotationBeanPostProcessor.if (jsr250Present && !registry.containsBeanDefinition(COMMON_ANNOTATION_PROCESSOR_BEAN_NAME)) {RootBeanDefinition def = new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class);def.setSource(source);beanDefs.add(registerPostProcessor(registry, def, COMMON_ANNOTATION_PROCESSOR_BEAN_NAME));}// Check for JPA support, and if present add the PersistenceAnnotationBeanPostProcessor.if (jpaPresent && !registry.containsBeanDefinition(PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME)) {RootBeanDefinition def = new RootBeanDefinition();try {def.setBeanClass(ClassUtils.forName(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME,AnnotationConfigUtils.class.getClassLoader()));}catch (ClassNotFoundException ex) {throw new IllegalStateException("Cannot load optional framework class: " + PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, ex);}def.setSource(source);beanDefs.add(registerPostProcessor(registry, def, PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME));}if (!registry.containsBeanDefinition(EVENT_LISTENER_PROCESSOR_BEAN_NAME)) {RootBeanDefinition def = new RootBeanDefinition(EventListenerMethodProcessor.class);def.setSource(source);beanDefs.add(registerPostProcessor(registry, def, EVENT_LISTENER_PROCESSOR_BEAN_NAME));}if (!registry.containsBeanDefinition(EVENT_LISTENER_FACTORY_BEAN_NAME)) {RootBeanDefinition def = new RootBeanDefinition(DefaultEventListenerFactory.class);def.setSource(source);beanDefs.add(registerPostProcessor(registry, def, EVENT_LISTENER_FACTORY_BEAN_NAME));}return beanDefs;}

 ==> 这里其实就是6个默认的spring内部bean的注册

(1) ConfigurationClassPostProcessor 配置类后置处理器

工厂后置处理器,这个后置处理器非常重要,基本上类上面的注解都在这里面判断并解析,spring的包扫描也在里面完成

 (2)  AutowiredAnnotationBeanPostProcessor 自动导入注解Bean后处置理器

主要是@Autowired,是一个bean的后置处理器,在bean的属性注入的时候会用到

(3)  CommonAnnotationBeanPostProcessor 通用注释Bean后置处理器

处理一些公共注解的,它是一个bean的后置处理器,可以处理@PostConstruct和@PreDestroy还有@Resource等

(4) PersistenceAnnotationBeanPostProcessor 持久性注释Bean后置处理器

对jpa的处理,所以需要引入spring-orm的包,没有引入的话则spring不会注册这个类

(5) internalEventListenerProcessor 内部事件监听器处理器

对 @EventListener 注解的处理,spring实现事件监听的方式有很多种,其中一种就是在方法上添加 @EventListener 注解

(6)  internalEventListenerFactory 内部事件监听器工厂

跟事件监听有关

接着我们看其中一个方法,挑第一个来跟一下逻辑代码

截图:

 接着看 registerPostProcessor 这个方法

截图:

 代码:

private static BeanDefinitionHolder registerPostProcessor(BeanDefinitionRegistry registry, RootBeanDefinition definition, String beanName) {definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);//registry 就是 AnnotationApplicationContext//这里是调用父类 GenericApplicationContext 中的 registerBeanDefinition 方法//调用 beanFactory 将 spring 默认的 BeanDefinition 注册进去registry.registerBeanDefinition(beanName, definition);//一开始就初始化了 DefaultListableBeanFactoryreturn new BeanDefinitionHolder(definition, beanName);}

接着看  registerBeanDefinition 方法

截图:

代码:

/*** Register a new bean definition with this registry.//在此注册表中注册一个新的bean定义,* Must support RootBeanDefinition and ChildBeanDefinition.//必须支持 RootBeanDefinition 和 ChildBeanDefinition* @param beanName the name of the bean instance to register //beanName 要注册的bean实例的名称* @param beanDefinition definition of the bean instance to register //beanDefinition  要注册的 bean 实例的定义* @throws BeanDefinitionStoreException if the BeanDefinition is invalid* @throws BeanDefinitionOverrideException if there is already a BeanDefinition* for the specified bean name and we are not allowed to override it //指定bean的名称,我们不允许覆盖它* @see GenericBeanDefinition* @see RootBeanDefinition* @see ChildBeanDefinition*/void registerBeanDefinition(String beanName, BeanDefinition beanDefinition)throws BeanDefinitionStoreException;

这是一个接口,继续看其具体实现类 

这里看默认的工厂实现类 DefaultListableBeanFactory

截图:

代码:

//---------------------------------------------------------------------// Implementation of BeanDefinitionRegistry interface//---------------------------------------------------------------------@Overridepublic void registerBeanDefinition(String beanName, BeanDefinition beanDefinition)throws BeanDefinitionStoreException {Assert.hasText(beanName, "Bean name must not be empty");Assert.notNull(beanDefinition, "BeanDefinition must not be null");if (beanDefinition instanceof AbstractBeanDefinition) {try {((AbstractBeanDefinition) beanDefinition).validate();}catch (BeanDefinitionValidationException ex) {throw new BeanDefinitionStoreException(beanDefinition.getResourceDescription(), beanName,"Validation of bean definition failed", ex);}}//在注册 bd 的时候判断该名字有没有被注册BeanDefinition existingDefinition = this.beanDefinitionMap.get(beanName);//该名字已经被注册//spring 默认支持覆盖 bd,但是 spring 会输入一些日志//1、两个 bd 相同的情况下//2、两个 bd 不同的情况 role 不同//3、两个 bd 不相同但是 role 相同if (existingDefinition != null) {if (!isAllowBeanDefinitionOverriding()) {throw new BeanDefinitionOverrideException(beanName, beanDefinition, existingDefinition);}//优先级else if (existingDefinition.getRole() < beanDefinition.getRole()) {// e.g. was ROLE_APPLICATION, now overriding with ROLE_SUPPORT or ROLE_INFRASTRUCTUREif (logger.isInfoEnabled()) {logger.info("Overriding user-defined bean definition for bean '" + beanName +"' with a framework-generated bean definition: replacing [" +existingDefinition + "] with [" + beanDefinition + "]");}}else if (!beanDefinition.equals(existingDefinition)) {if (logger.isDebugEnabled()) {logger.debug("Overriding bean definition for bean '" + beanName +"' with a different definition: replacing [" + existingDefinition +"] with [" + beanDefinition + "]");}}else {if (logger.isTraceEnabled()) {logger.trace("Overriding bean definition for bean '" + beanName +"' with an equivalent definition: replacing [" + existingDefinition +"] with [" + beanDefinition + "]");}}this.beanDefinitionMap.put(beanName, beanDefinition);}else {//判断我们的 spring 容器是否开启实例化 bean了//如果为null,set 为空,没有开始就创建 bean 不会进入 ifif (hasBeanCreationStarted()) {// Cannot modify startup-time collection elements anymore (for stable iteration)synchronized (this.beanDefinitionMap) {//一个 map 一个 list ,list里面方法的 map 的 key,也就是 beanNamethis.beanDefinitionMap.put(beanName, beanDefinition);List<String> updatedDefinitions = new ArrayList<>(this.beanDefinitionNames.size() + 1);updatedDefinitions.addAll(this.beanDefinitionNames);updatedDefinitions.add(beanName);this.beanDefinitionNames = updatedDefinitions;//如果注册了 beanDefinition 的名字和手工注册的 bd 集合当中某个相同则删除手动注册的 beanNameremoveManualSingletonName(beanName);}}else {// Still in startup registration phasethis.beanDefinitionMap.put(beanName, beanDefinition);this.beanDefinitionNames.add(beanName);removeManualSingletonName(beanName);}this.frozenBeanDefinitionNames = null;}//判断注册的 bd 以及 beanName 是否存在if (existingDefinition != null || containsSingleton(beanName)) {//清除 allBeanNameByType//把单例池当中的 bean 也 removeresetBeanDefinition(beanName);}}

 this.beanDefinitionMap.put(beanName, beanDefinition);

 从这里可以看到bean已经存在到 IOC容器中,到此 AnnotatedBeanDefinitionReader 分析结束

接着看 ClassPathBeanDefinitionScanner 的构造方法

2.2  ClassPathBeanDefinitionScanner 构造方法

这个方法主要是创建BeanDefinition扫描器,可以用来扫描包或者类,继而转换为bd,spring默认的扫描器其实不是这个scanner对象, 而是在后面自己又重新new了一个ClassPathBeanDefinitionScanner, spring在执行工程后置处理器ConfigurationClassPostProcessor时,去扫描包时会new一个ClassPathBeanDefinitionScanner
这里的scanner仅仅是为了程序员可以手动调用AnnotationConfigApplicationContext对象的scan方法


所以这里不展开看了。

 

 

 3、最后回到我们最开始的地方, 可以看到 spring 初始化上下文已经有了,打个断点可以看到IOC容器已经实例化了一些对象,就是上面的6中默认bean,

截图:

参考博客:

1、https://blog.csdn.net/zzzzzyyyz/article/details/116999121

2、spring加载流程之AnnotatedBeanDefinitionReader_浴缸灬的博客-CSDN博客

3、SpringBoot源码深度剖析——@SpringBootApplication注解和new SpringApplication().run()方法深度解密_生活,没那么矫情的博客-CSDN博客

 

 

 

相关文章:

SpringBoot 源码分析初始化应用上下文(1)-createApplicationContext

前言&#xff1a;springBoot的版本是 2.2.4.RELEASE 一、入口 /*** 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 A…...

STM32队列

目录 什么是队列&#xff1f; 队列特点 1. 数据入队出队方式 2. 数据传递方式 3. 多任务访问 4. 出队、入队阻塞 队列相关 API 函数 1. 创建队列 参数&#xff1a; 2. 写队列 参数&#xff1a; 返回值&#xff1a; 3. 读队列 参数&#xff1a; 返回值&#xf…...

探索Beyond Compare:让文件比较和管理变得简单高效

在这个信息爆炸时代&#xff0c;我们的日常生活和工作中需要处理大量的数据和文档。在这个过程中&#xff0c;有时候我们会面临找出不同文件之间的差异、合并重复内容等需求。那么&#xff0c;有没有一款软件可以帮助我们轻松地完成这些任务呢&#xff1f;答案当然是肯定的&…...

动态网站Servelt基础

文章目录 一、Servlet基础&#xff08;一&#xff09;Servlet概述1、Servlet是什么2、Servlet容器3、Servlet应用程序的体系结构 &#xff08;二&#xff09;Servlet的特点1、功能强大2、可移植3、性能高效4、安全性高5、可扩展 &#xff08;三&#xff09;Servlet接口1、Servl…...

Docker 网络

Docker 网络实现原理 Docker使用Linux桥接&#xff0c;在宿主机虚拟一个Docker容器网桥(docker0)&#xff0c;Docker启动一个容器时会根据Docker网桥的网段分配给容器一个IP地址&#xff0c;称为Container-IP&#xff0c;同时Docker网桥是每个容器的默认网关。因为在同一宿主机…...

Tomcat的优化

Tomcat的优化 一、Tomcat 优化Tomcat 配置文件参数优化 二、系统内核优化三、Tomcat 配置 JVM 参数&#xff1a;参数含义 一、Tomcat 优化 Tomcat默认安装下的缺省配置并不适合生产环境&#xff0c;它可能会频繁出现假死现象需要重启&#xff0c;只有通过不断压测优化才能让它…...

一个问题来对比文心一言和chatgpt

问题&#xff1a; 请注意&#xff0c; 孩子不会说话&#xff0c;他无法用语言来回复妈妈的问题&#xff0c; 请生成以下剧本&#xff1a;一个妈妈和一岁不会说话的婴儿的日常vlog的剧本 文心一言 场景一&#xff1a;早晨 &#xff08;妈妈和孩子在客厅里醒来&#xff09; 妈妈&…...

防雪崩利器之Hystrix

Hystrix作为一个容错组件&#xff0c;本文从它的作用、熔断设计、工作流程和应用方面一一道来&#xff0c;帮助大家了解如何使用。 1、什么是灾难性雪崩效应 要讲Hystrix&#xff0c;我们就要讲一种场景&#xff0c;在微服务架构中&#xff0c;如果底层服务出现故障&#xff0…...

机器学习复习(上)

严正声明&#xff1a;本文的答案是ChatGPT的回答&#xff0c;仅供参考&#xff0c;不代表就是正确答案&#xff01;&#xff01;&#xff01; 1.解释什么是过拟合和欠拟合&#xff0c;如何降低过拟合? 过拟合&#xff08;overfitting&#xff09;指的是一个模型在训练数据上表…...

node笔记_express结合formidable实现前后端的文件上传

文章目录 ⭐前言⭐安装http请求的文件解析依赖库&#x1f496; 安装 formidable&#x1f496; node formidable接受formData上传参数 ⭐上传的页面搭建&#x1f496; vue2 element upload&#x1f496; node 渲染 上传文件 ⭐后端生成api上传文件到指定目录&#x1f496;完整的…...

CKA 09_Kubernetes工作负载与调度 资源调度 三类QoS request 资源需求 limit 资源限额

文章目录 1. 资源调度1.1 准备工作1.2 为什么需要 request 和 limit1.3 内存限制1.3.1 Brustable1.3.2 Guaranteed1.3.3 BestEffort1.3.4 当容器申请的资源超出 limit 和 request 1.4 CPU限制 1. 资源调度 1.1 准备工作 Kubernetes 采用 request 和 limit 两种限制类型来对资源…...

【pytorch】维度变换

【pytorch】维度变换 View操作unSqueeze操作图片处理的一个案例squeeze 维度删减操作维度扩展-expand维度扩展-repeat矩阵的转置操作-transpose View操作 将一个四维的张量&#xff08;b x c x h x w&#xff09;转换成一个二维的张量 对于四张图片 将每一张图像用一行向量进…...

vue3中的nextTick()

目录 nextTick() 方法用法回调函数方式使用await方式使用 实现原理使用nextTick() 方法时的注意事项 nextTick() 方法 nextTick() 方法是一个非常强大的工具&#xff0c;是一个等待下一次 DOM 更新刷新的工具方法。用于将一个函数以异步的方式推迟到下一个 DOM 更新周期执行。…...

高效学习传感器|霍尔式传感器

01、霍尔式传感器的工作原理 1●霍尔效应 霍尔式传感器的物理基础是霍尔效应。如图1所示&#xff0c;在一块长度为l、宽度为b、厚度为d的长方体导电板上&#xff0c;左、右、前、后侧面都安装上电极。在长度方向上通入电流I&#xff0c;在厚度方向施加磁感应强度为B的磁场。 ■…...

2023年前端面试高频考点HTML5+CSS3

目录 浏览器的渲染过程⭐⭐⭐ CSS 、JS 阻塞 DOM 解析和渲染 回流&#xff08;重排&#xff09;和重绘⭐⭐ 选择器 ID选择器、类选择器、标签选择器&#xff08;按优先级高到低排序&#xff09;⭐⭐ 特殊符号选择器&#xff08;&#xff1e;,,~&#xff0c;空格&#xff0…...

企业开源测试项目实战(附全套实战项目教程+视频+源码)

接口测试项目 1. No matching distribution found for itypes1.1.0 Could not find a version that satisfies the requirement itypes1.1.0 (from -r requirements.txt (line 8)) (from versions: ) No matching distribution found for itypes1.1.0 (from -r requirements.…...

信创办公–基于WPS的EXCEL最佳实践系列 (创建表格)

信创办公–基于WPS的EXCEL最佳实践系列 &#xff08;创建表格&#xff09; 目录 应用背景操作步骤1、新建空白工作簿并命名为“奖牌榜”2、使用模板新建工作簿3、新增一张工作表&#xff0c;并将工作簿的标签更改为红色4、复制与隐藏工作表5、添加工作簿属性值6、更改工作簿主题…...

四、HAL_驱动机械按键

1、开发环境。 (1)KeilMDK&#xff1a;V5.38.0.0 (2)STM32CubeMX&#xff1a;V6.8.1 (3)MCU&#xff1a;STM32F407ZGT6 2、机械按键简介 (1)按键内部是机械结构&#xff0c;也就是内部是没有电路的。按键按下内部引脚导通&#xff0c;松开内部断开。 3、实验目的&原理…...

机器学习实战六步法之数据收集方法(四)

要落地一个机器学习的项目&#xff0c;是有章可循的&#xff0c;通过这六个步骤&#xff0c;小白也能搞定机器学习。 看我闪电六连鞭&#xff01;&#x1f923; 数据收集 数据是机器学习的基础&#xff0c;没有数据一切都是空谈&#xff01;数据集的数据量和数据的质量往往决…...

神经网络:CNN中的filter,kernel_size,strides,padding对输出形状的影响

输入数据在经过卷积层后&#xff0c;形状一般会发生改变&#xff0c;而形状的变化往往与以下四个超参数有关。 1&#xff0c;filter&#xff08;out_channel&#xff09; 该超参数控制着输入数据经过卷积层中需要与几个卷积核进行运算&#xff0c;而输入数据与每个卷积核进行…...

本地化部署AI做表格工具评测:数以轻舟Agent技术架构与落地实践

一、产品定位与核心架构数以轻舟Agent是一款面向Excel数据处理场景的垂直型AI智能体&#xff0c;由北京乾策数智科技有限公司开发&#xff0c;2025年12月推出首款产品&#xff0c;2026年5月正式上线本地化部署版本。产品核心定位并非通用AI助手&#xff0c;而是聚焦"AI做表…...

群晖相册人脸识别终极指南:3步解锁无GPU设备的AI功能

群晖相册人脸识别终极指南&#xff1a;3步解锁无GPU设备的AI功能 【免费下载链接】Synology_Photos_Face_Patch Synology Photos Facial Recognition Patch 项目地址: https://gitcode.com/gh_mirrors/sy/Synology_Photos_Face_Patch 还在为群晖DS918等无GPU设备无法使用…...

工程人福音!一键提取图纸文字,告别手动打字

建筑工程施工管理工作中&#xff0c;涉及大量文书资料编制&#xff0c;涵盖施工组织设计、专项施工方案、各类报告文件、招投标技术标撰写、项目概况说明、工程量清单项目特征描述等诸多文字内容。此类资料编辑工作量大、耗时费力&#xff0c;人工录入不仅效率低下&#xff0c;…...

如何用FanControl在5分钟内解决Windows风扇噪音问题?

如何用FanControl在5分钟内解决Windows风扇噪音问题&#xff1f; 【免费下载链接】FanControl.Releases This is the release repository for Fan Control, a highly customizable fan controlling software for Windows. 项目地址: https://gitcode.com/GitHub_Trending/fa/…...

AI Agent + 指纹浏览器:从0搭建MCP Server实现批量账号自动化管理

我是张大鹏&#xff0c;做了十多年人工智能&#xff0c;带过不少项目。说实话&#xff0c;AI Agent 最难的不是生成内容&#xff0c;是"动手干活"——大模型再强&#xff0c;如果只能输出文字而不能操控真实环境&#xff0c;自动化就永远差最后一公里。最近在研究 In…...

LNG船BOG再液化系统流程优化与动态蒸发率控制【附模型】

✨ 本团队擅长数据搜集与处理、建模仿真、程序设计、仿真代码、EI、SCI写作与指导&#xff0c;毕业论文、期刊论文经验交流。 ✅ 专业定制毕设、代码 ✅如需沟通交流&#xff0c;点击《获取方式》 &#xff08;1&#xff09;液氮预冷BOG缓冲再液化系统流程设计与Aspen HYSYS建模…...

突破大语言模型平滑诅咒:Emergence Codex语义架构与OpenClaw实战指南

1. 项目概述&#xff1a;什么是 Emergence Codex 与 OpenClaw Skill如果你和我一样&#xff0c;在深度使用大语言模型&#xff08;LLM&#xff09;构建智能体或进行复杂推理任务时&#xff0c;常常感到一种无力感——无论你怎么精心设计提示词&#xff08;Prompt&#xff09;&a…...

C语言中的数据类型存储

1、二进制和进制转换我们经常能听到 2 进制、 8 进制、 10 进制、 16 进制 这样的讲法&#xff0c;那是什么意思呢&#xff1f;其实2进制、8进制、10进制、16进制是数值的不同表⽰形式⽽已。⽐如&#xff1a;数值15的各种进制的表⽰形式(十六进制的数值之前写&#xff1a;0x &a…...

芯片功能验证的范式革新:从约束随机到目标驱动的智能场景生成

1. 功能验证的十字路口&#xff1a;我们为何陷入困境&#xff1f;在芯片设计这个行当里摸爬滚打了十几年&#xff0c;我亲眼见证了功能验证从一个相对简单的环节&#xff0c;演变成如今整个设计流程中最耗时、最昂贵、也最令人头疼的瓶颈。这感觉就像你精心设计了一辆跑车&…...

开源代理解决 DeepSeek V4 与 Claude Code 的三个兼容性陷阱解决方案

在使用 Claude Code 的过程中&#xff0c;Anthropic 官方 API 的调用成本和网络问题一直是个痛点。DeepSeek V4 提供了兼容 Anthropic 格式的 API&#xff0c;价格优势明显&#xff0c;但实际对接时存在若干协议层面的差异&#xff0c;直接使用的话在进行 Agent spawn 工具调用…...