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

建设云网站/网推资源渠道

建设云网站,网推资源渠道,wordpress 自定义栏目 图片,人大网站模板属性填充 属性填充只有 3 种方式 根据名称填充 根据类型填充 思考什么时候会出现呢??? 多见于第三方框架与 Spring集成,举例:Mybatis 与 Spring集成,把 Mapper 接口注册为 BeanDefinition 时候就指定了自…

属性填充

属性填充只有 3 种方式

  • 根据名称填充

  • 根据类型填充

    思考什么时候会出现呢???

    多见于第三方框架与 Spring集成,举例:Mybatis 与 Spring集成,把 Mapper 接口注册为 BeanDefinition 时候就指定了自动注入模式为『 按类型注入

    // 代码位置:org.mybatis.spring.mapper.ClassPathMapperScanner#processBeanDefinitions方法
    definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
    
  • 后置处理器,基本近似认为是 AutowiredAnnotationBeanPostProcessor

    多见于自己开发的时候,如通过注解@Autowired 注入,或通过注解@Value 注入

1. 总体流程

protected void populateBean(String beanName, RootBeanDefinition mbd, @Nullable BeanWrapper bw) {boolean continueWithPropertyPopulation = true;// <1> 应用InstantiationAwareBeanPostProcessor的postProcessAfterInstantiation方法if (!mbd.isSynthetic() && hasInstantiationAwareBeanPostProcessors()) {for (BeanPostProcessor bp : getBeanPostProcessors()) {if (bp instanceof InstantiationAwareBeanPostProcessor) {InstantiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) bp;if (!ibp.postProcessAfterInstantiation(bw.getWrappedInstance(), beanName)) {continueWithPropertyPopulation = false;break;}}}}if (!continueWithPropertyPopulation) {return;}PropertyValues pvs = (mbd.hasPropertyValues() ? mbd.getPropertyValues() : null);// <2> 根据名称自动注入 或者 根据类型自动注入if (mbd.getResolvedAutowireMode() == AUTOWIRE_BY_NAME || mbd.getResolvedAutowireMode() == AUTOWIRE_BY_TYPE) {MutablePropertyValues newPvs = new MutablePropertyValues(pvs);// Add property values based on autowire by name if applicable// <2.1> 根据名称添加属性值if (mbd.getResolvedAutowireMode() == AUTOWIRE_BY_NAME) {autowireByName(beanName, mbd, bw, newPvs);}// Add property values based on autowire by type if applicable// <2.2> 根据类型添加属性值if (mbd.getResolvedAutowireMode() == AUTOWIRE_BY_TYPE) {autowireByType(beanName, mbd, bw, newPvs);}pvs = newPvs;}boolean hasInstAwareBpps = hasInstantiationAwareBeanPostProcessors();boolean needsDepCheck = (mbd.getDependencyCheck() != AbstractBeanDefinition.DEPENDENCY_CHECK_NONE);PropertyDescriptor[] filteredPds = null;if (hasInstAwareBpps) {if (pvs == null) {pvs = mbd.getPropertyValues();}// <3> 应用InstantiationAwareBeanPostProcessor的postProcessProperties方法for (BeanPostProcessor bp : getBeanPostProcessors()) {if (bp instanceof InstantiationAwareBeanPostProcessor) {InstantiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) bp;PropertyValues pvsToUse = ibp.postProcessProperties(pvs, bw.getWrappedInstance(), beanName);if (pvsToUse == null) {if (filteredPds == null) {filteredPds = filterPropertyDescriptorsForDependencyCheck(bw, mbd.allowCaching);}pvsToUse = ibp.postProcessPropertyValues(pvs, filteredPds, bw.getWrappedInstance(), beanName);if (pvsToUse == null) {return;}}pvs = pvsToUse;}}}// <4> 设置属性值if (pvs != null) {applyPropertyValues(beanName, mbd, bw, pvs);}
}
  • <1> 处,应用InstantiationAwareBeanPostProcessor的postProcessAfterInstantiation方法,在实例化之后是否继续处理,一般都会继续处理
  • <2> 处,根据名称 或 类型自动注入
    • <2.1> 处,根据名称自动注入(重点分析)
    • <2.2> 处,根据类型自动注入(重点分析)
  • <3> 处,应用InstantiationAwareBeanPostProcessor的postProcessProperties方法,一般的,就用应用 AutowiredAnnotationBeanPostProcessor 完成 @Autowired@Value 注解的处理
  • <4> 处,这里 pvs 变量已经是得到的值了,这里只需要把值设置到 bw 实例中

2. 各种类型的注入

结论:无论是哪一种类型的注入,最后都会调用 getBean 方法,下面的分析只是简单的说明下如何一步一步调用到 getBean 方法的

2.1 按名称填充(autowireByName方法)

总结:这个直接调用 getBean 方法,很简单很好!

protected void autowireByName(String beanName, AbstractBeanDefinition mbd, BeanWrapper bw, MutablePropertyValues pvs) {// <1> 用内省机制查找需要注入的属性String[] propertyNames = unsatisfiedNonSimpleProperties(mbd, bw);for (String propertyName : propertyNames) {if (containsBean(propertyName)) {// <2> 既然是使用根据名称注入,那么简单了直接 getBean(String) 方法Object bean = getBean(propertyName);// <3> 添加到 pvs 中,返回后设置到pvs.add(propertyName, bean);registerDependentBean(propertyName, beanName);}}
}
  • <1> 处, 用内省机制查找需要注入的属性(我们重点查看)

    如何用内省机制查找属性???

    protected String[] unsatisfiedNonSimpleProperties(AbstractBeanDefinition mbd, BeanWrapper bw) {Set<String> result = new TreeSet<>();PropertyValues pvs = mbd.getPropertyValues();// <1>、内省机制查找属性PropertyDescriptor[] pds = bw.getPropertyDescriptors();for (PropertyDescriptor pd : pds) {// <2> 并不是所有的属性都需要注入,所以要做过滤(过滤条件:要有 write 方法;不是简单属性而是我们常见的需要注入的属性;pvs 不包含)if (pd.getWriteMethod() != null && !isExcludedFromDependencyCheck(pd) && !pvs.contains(pd.getName()) &&!BeanUtils.isSimpleProperty(pd.getPropertyType())) {result.add(pd.getName());}}return StringUtils.toStringArray(result);
    }
    

    结果一些代码会来到如下方法

    private CachedIntrospectionResults(Class<?> beanClass) throws BeansException {// <1> 内省机制得到 BeanInfo 对象this.beanInfo = getBeanInfo(beanClass);this.propertyDescriptorCache = new LinkedHashMap<>();// <2> 内省机制获取属性PropertyDescriptor[] pds = this.beanInfo.getPropertyDescriptors();for (PropertyDescriptor pd : pds) {pd = buildGenericTypeAwarePropertyDescriptor(beanClass, pd);this.propertyDescriptorCache.put(pd.getName(), pd);}// <3> 循环处理父接口啊Class<?> currClass = beanClass;while (currClass != null && currClass != Object.class) {introspectInterfaces(beanClass, currClass);currClass = currClass.getSuperclass();}}
    
    • <1> 处,使用内省机制获取到 beanClass 的 BeanInfo 信息

      内省机制:Introspector.getBeanInfo(beanClass)

    • <2> 处,获取属性会获取到父类的所有属性

    • <3> 处,循环处理父接口啊,为什么不处理父类,因为不需要处理,内省机制获取属性已经包含了父类的属性

  • <2> 处, 因为是使用名称注入,那么直接用属性的名称,然后调用 getBean(String) 方法

  • <3> 处,把 bean 设置到 pvs 中返回,交由主方法调用 setXxx 方法把数据设置到目标中

2.2 按类型填充(autowireByType方法)

跟按名称注入大致一样,比它略多几个步骤(多一个解析依赖),代码如下:

protected void autowireByType(String beanName, AbstractBeanDefinition mbd, BeanWrapper bw, MutablePropertyValues pvs) {TypeConverter converter = getCustomTypeConverter();if (converter == null) {converter = bw;}Set<String> autowiredBeanNames = new LinkedHashSet<>(4);// <1> 内省机制查找注入属性String[] propertyNames = unsatisfiedNonSimpleProperties(mbd, bw);for (String propertyName : propertyNames) {PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);if (Object.class != pd.getPropertyType()) {MethodParameter methodParam = BeanUtils.getWriteMethodParameter(pd);boolean eager = !PriorityOrdered.class.isInstance(bw.getWrappedInstance());DependencyDescriptor desc = new AutowireByTypeDependencyDescriptor(methodParam, eager);// <2> 解析依赖,重点方法Object autowiredArgument = resolveDependency(desc, beanName, autowiredBeanNames, converter);if (autowiredArgument != null) {pvs.add(propertyName, autowiredArgument);}}}
}
  • <1> 处,用内省机制查找注入的属性的 unsatisfiedNonSimpleProperties 方法,同前面的『 按名称填充(autowireByName方法) 』,略

  • <2> 处,重点分析解析依赖

    resolveDependency 方法完成依赖解析,其实也就是最后调用 getBean 方法!!!

    public Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName,@Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) throws BeansException {// 解析依赖result = doResolveDependency(descriptor, requestingBeanName, autowiredBeanNames, typeConverter);return result;
    }
    
    public Object doResolveDependency(DependencyDescriptor descriptor, @Nullable String beanName,@Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) throws BeansException {InjectionPoint previousInjectionPoint = ConstructorResolver.setCurrentInjectionPoint(descriptor);try {// <1> 如果注入的类型是 Array、List、Map 等集合类型Object multipleBeans = resolveMultipleBeans(descriptor, beanName, autowiredBeanNames, typeConverter);if (multipleBeans != null) {return multipleBeans;}// <2> 注入的不是集合类型,但可能匹配了多个Map<String, Object> matchingBeans = findAutowireCandidates(beanName, type, descriptor);if (matchingBeans.isEmpty()) {if (isRequired(descriptor)) {raiseNoMatchingBeanFound(type, descriptor.getResolvableType(), descriptor);}return null;}if (matchingBeans.size() > 1) {// <2.1> 类型匹配了多个,那么就要决定使用哪一个(如在@Primary and @Priority就会出现这种情况)autowiredBeanName = determineAutowireCandidate(matchingBeans, descriptor);instanceCandidate = matchingBeans.get(autowiredBeanName);}else {// <2.2> 刚好匹配一个,更多的是这种情况Map.Entry<String, Object> entry = matchingBeans.entrySet().iterator().next();autowiredBeanName = entry.getKey();instanceCandidate = entry.getValue();}if (autowiredBeanNames != null) {autowiredBeanNames.add(autowiredBeanName);}if (instanceCandidate instanceof Class) {// <3> 解析候选值,这里会调用 getBean 方法instanceCandidate = descriptor.resolveCandidate(autowiredBeanName, type, this);}Object result = instanceCandidate;// <4> 返回 getBean 方法结果return result;}finally {ConstructorResolver.setCurrentInjectionPoint(previousInjectionPoint);}
    }
    
    • <1> 处,处理集合类型的注入(如 Array、List、Map等)
    • <2> 处,处理单个注入,但是也可能会匹配到多个此时就需要考虑优先级选择出一个(如 @Primary 注解)
    • <3> 处,调用 getBean 方法完成实际的依赖注入
    • <4> 处,返回注入的结果
    public Object resolveCandidate(String beanName, Class<?> requiredType, BeanFactory beanFactory)throws BeansException {// 终于看到我们想要看的 getBean 方法了!return beanFactory.getBean(beanName);
    }
    

2.3 AutowiredAnnotationBeanPostProcessor的postProcessProperties方法

public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName) {// <1> 发现 Autowired 元数据InjectionMetadata metadata = findAutowiringMetadata(beanName, bean.getClass(), pvs);// <2> 执行实际注入metadata.inject(bean, beanName, pvs);return pvs;
}
  • <1> 处,查找 beanClass 中的@Autowired 元数据信息

    private InjectionMetadata buildAutowiringMetadata(final Class<?> clazz) {List<InjectionMetadata.InjectedElement> elements = new ArrayList<>();Class<?> targetClass = clazz;do {final List<InjectionMetadata.InjectedElement> currElements = new ArrayList<>();// <1> 查找本地字段ReflectionUtils.doWithLocalFields(targetClass, field -> {// 是不是有@Autowired 或 @Value 这些注解AnnotationAttributes ann = findAutowiredAnnotation(field);if (ann != null) {boolean required = determineRequiredStatus(ann);currElements.add(new AutowiredFieldElement(field, required));}});// <2> 查找本地方法ReflectionUtils.doWithLocalMethods(targetClass, method -> {// 是不是有@Autowired 或 @Value 这些注解Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(method);if (!BridgeMethodResolver.isVisibilityBridgeMethodPair(method, bridgedMethod)) {return;}AnnotationAttributes ann = findAutowiredAnnotation(bridgedMethod);if (ann != null && method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {boolean required = determineRequiredStatus(ann);PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz);currElements.add(new AutowiredMethodElement(method, required, pd));}});// <3> 处理父类elements.addAll(0, currElements);targetClass = targetClass.getSuperclass();}while (targetClass != null && targetClass != Object.class);return new InjectionMetadata(clazz, elements);
    }
    
    • <1> 处,处理了本地字段是否包含了指定的注解,如果包含则加入到元数据中
    • <2> 处,处理了本地方法是否包含了指定的注解,如果包含则加入到元数据中
    • <3> 处,循环处理父类直到全部处理完毕
  • <2> 处,根据前面得到的InjectionMetadata,执行实际的注入,最后会调用到 getBean 方法,以下简单代码描述如何一步一步调用到 getBean 方法

    public void inject(Object target, @Nullable String beanName, @Nullable PropertyValues pvs) throws Throwable {Collection<InjectedElement> checkedElements = this.checkedElements;Collection<InjectedElement> elementsToIterate =(checkedElements != null ? checkedElements : this.injectedElements);// 循环处理每个注入元数据的注入if (!elementsToIterate.isEmpty()) {for (InjectedElement element : elementsToIterate) {element.inject(target, beanName, pvs);}}
    }
    
    protected void inject(Object bean, @Nullable String beanName, @Nullable PropertyValues pvs) throws Throwable {// <1> 解析@Autowired 依赖value = beanFactory.resolveDependency(desc, beanName, autowiredBeanNames, typeConverter);// <2> 反射设置字段的值if (value != null) {ReflectionUtils.makeAccessible(field);field.set(bean, value);}
    }
    
    • <1> 处,依赖解析方法 resolveDependency 同前面的『 按类型填充(autowireByType方法) 』,略

    • <2> 处,使用了反射设置属性值,并没有像autowireByName 或 autowireByType 一样把属性添加到 pvs 中,最后才设置属性

3. 属性值设置

相关文章:

Spring 属性填充源码分析(简单实用版)

属性填充 属性填充只有 3 种方式 根据名称填充 根据类型填充 思考什么时候会出现呢&#xff1f;&#xff1f;&#xff1f; 多见于第三方框架与 Spring集成&#xff0c;举例&#xff1a;Mybatis 与 Spring集成&#xff0c;把 Mapper 接口注册为 BeanDefinition 时候就指定了自…...

【机器学习分支】重要性采样(Importance sampling)学习笔记

重要性采样&#xff08;importance sampling&#xff09;是一种用于估计概率密度函数期望值的常用蒙特卡罗积分方法。其基本思想是利用一个已知的概率密度函数来生成样本&#xff0c;从而近似计算另一个概率密度函数的期望值。 想从复杂概率分布中采样的一个主要原因是能够使用…...

三角回文数+123

三角回文数&#xff1a;用户登录 问题描述 对于正整数 n, 如果存在正整数 k 使得 n123⋯kk(k1)/2​, 则 n 称为三角数。例如, 66066 是一个三角数, 因为 66066123⋯363 。 如果一个整数从左到右读出所有数位上的数字, 与从右到左读出所有数位 上的数字是一样的, 则称这个数为…...

JAVA常用的异步处理方法总结

前言 在java项目开发过程中经常会遇到比较耗时的任务&#xff0c;通常是将这些任务做成异步操作&#xff0c;在java中实现异步操作有很多方法&#xff0c;本文主要总结一些常用的处理方法。为了简化&#xff0c;我们就拿一个实际的案例&#xff0c;再用每种方法去实现&#xf…...

GitLab统计代码量

gitlab官方文档&#xff1a;https://docs.gitlab.com/ee/api/index.html 1、生成密钥 登录gitlab&#xff0c;编辑个人资料&#xff0c;设置访问令牌 2、获取当前用户所有可见的项目 接口地址 GET请求 http://gitlab访问地址/api/v4/projects?private_tokenxxx 返回参数 …...

Linux TCP MIB统计汇总

概述 在 linux > 4.7 才将所有TCP丢包收敛到 函数 tcp_drop 中 指标详解 cat /proc/net/netstat 格式化命令 cat /proc/net/netstat | awk (f0) {name$1; i2; while ( i<NF) {n[i] $i; i }; f1; next} (f1){ i2; while ( i<NF){ printf "%s%s %d\n", …...

记录 docker linux部署jar

第一步 web sso user admin 中yml文件还原到阿里mysql数据库 第二步 各个jar进行打包处理 第三步 正式服务器的Jar备份 第四步 拉取以上jar包 到正式服务器中 第五步 查看 docker images 其中 web_service 1.0.2是上一个版本 上一个版本build 镜像命令是这样的&#xff08;需…...

【Linux】教你用进程替换制作一个简单的Shell解释器

本章的代码可以访问这里获取。 由于程序代码是一体的&#xff0c;本章在分开讲解各部分的实现时&#xff0c;代码可能有些跳跃&#xff0c;建议在讲解各部分实现后看一下源代码方便理解程序。 制作一个简单的Shell解释器 一、观察Shell的运行状态二、简单的Shell解释器制作原理…...

onMeasure里如何重置只有1个子view一行满屏, 若有多个自适应一行

onMeasure里如何重置只有1个子view一行满屏, 若有多个自适应一行 可以尝试在 onMeasure 方法中重写 measureChildWithMargins 或 measureChild 方法来实现这个需求。 对于只有一个字的 View,我们可以把它的宽度设为屏幕宽度,高度设为最大高度,这样这个 View 就会占满一整行…...

Postman创建项目 对接口发起请求处理

查看本文之前 您需要理解了解 Postman 的几个简单工作区 如果还没有掌握 可以先查看我的文章 简单认识 Postman界面操作 那么 掌握之后 我们就可以正式来开启我们的接口测试 我们先选择 Collections 我们点上面这个加号 多拉一个项目出来 然后 我们选我们刚加号点出来的项目…...

在Vue3项目中js-cookie库的使用

文章目录 前言1.安装js-cookie库2.引入、使用js-cookie库 前言 今天分享一下在Vue3项目中引入使用js-cookie。 1.安装js-cookie库 js-cookie官网 安装js-cookie&#xff0c;输入 npm i js-cookie安装完成可以在package.json中看到&#xff1a; 安装以后&#xff0c;就可…...

【论文笔记】Attention和Visual Transformer

Attention和Visual Transformer Attention和Transformer为什么需要AttentionAttention机制Multi-head AttentionSelf Multi-head Attention&#xff0c;SMA TransformerVisual Transformer&#xff0c;ViT Attention和Transformer Attention机制在相当早的时间就已经被提出了&…...

独立IP服务器和共享IP服务器有什么区别

在选择一个合适的服务器时&#xff0c;最常见的选择是共享IP服务器和独立IP服务器。尽管两者看起来很相似&#xff0c;但它们有着很大的不同。本文将详细介绍共享IP服务器和独立IP服务器的不同之处&#xff0c;以及如何选择适合您需求的服务器。 一、什么是共享IP服务器? 共享…...

Java8

Java8 &#xff08;一&#xff09;、双列集合&#xff08;二&#xff09;、Map集合常用api&#xff08;三&#xff09;、Map集合的遍历方式&#xff08;四&#xff09;、HashMap&#xff08;五&#xff09;、LinkedHashMap&#xff08;六&#xff09;、TreeMap&#xff08;七&a…...

nn.conv1d的输入问题

Conv1d(in_channels, out_channels, kernel_size, stride1, padding0, dilation1, groups1, biasTrue) in_channels(int) – 输入信号的通道。在文本分类中&#xff0c;即为词向量的维度out_channels(int) – 卷积产生的通道。有多少个out_channels&#xff0c;就需要多少个1维…...

js判断是否为null,undefined,NaN,空串或者空对象

js判断是否为null&#xff0c;undefined&#xff0c;NaN&#xff0c;空串或者空对象 这里写目录标题 js判断是否为null&#xff0c;undefined&#xff0c;NaN&#xff0c;空串或者空对象特殊值nullundefinedNaN空字符串&#xff08;""&#xff09;空对象&#xff08;…...

Java每日一练(20230501)

目录 1. 路径交叉 &#x1f31f;&#x1f31f; 2. 环形链表 &#x1f31f;&#x1f31f; 3. 被围绕的区域 &#x1f31f;&#x1f31f; &#x1f31f; 每日一练刷题专栏 &#x1f31f; Golang每日一练 专栏 Python每日一练 专栏 C/C每日一练 专栏 Java每日一练 专栏…...

从零开始学习Web自动化测试:如何使用Selenium和Python提高效率?

B站首推&#xff01;2023最详细自动化测试合集&#xff0c;小白皆可掌握&#xff0c;让测试变得简单、快捷、可靠https://www.bilibili.com/video/BV1ua4y1V7Db 目录 引言&#xff1a; 一、了解Web自动化测试的基本概念 二、选择Web自动化测试工具 三、学习Web自动化测试的…...

fastdfs环境搭建

安装包下载路径 libfastcommon下载地址&#xff1a;https://github.com/happyfish100/libfastcommon/releasesFastDFS下载地址&#xff1a;https://github.com/happyfish100/fastdfs/releasesfastdfs-nginx-module下载地址&#xff1a;https://github.com/happyfish100/fastdf…...

有什么牌子台灯性价比高?性价比最高的护眼台灯

由心感叹现在的孩子真不容易&#xff0c;学习压力比我们小时候大太多&#xff0c;特别是数学&#xff0c;不再是简单的计算&#xff0c;而更多的是培养学生其他思维方式&#xff0c;有时候我都觉得一年级数学题是不是超纲了。我女儿现在基本上都是晚上9点30左右上床睡觉&#x…...

信息系统项目管理师 第9章 项目范围管理

1.管理基础 1.产品范围和项目范围 产品范围:某项产品、服务或成果所具有的特征和功能。根据产品需求来衡量。 项目范围:包括产品范围&#xff0c;是为交付具有规定特性与功能的产品、服务或成果而必须完成的工作。项目管理计划来衡量 2.管理新实践 更加注重与商业分析师一起…...

【Android入门到项目实战-- 8.2】—— 使用HTTP协议访问网络

目录 一、使用HttpURLConnection 1、使用Android的HttpURLConnection步骤 1&#xff09;获取HttpURLConnection实例 2)设置HTTP请求使用的方法 3)定制HTTP请求&#xff0c;如连接超时、读取超时的毫秒数 4)调用getInputStream()方法获取返回的输入流 5)关闭HTTP连接 2、…...

Go官方指南(五)并发

Go 程 Go 程&#xff08;goroutine&#xff09;是由 Go 运行时管理的轻量级线程。 go f(x, y, z) 会启动一个新的 Go 程并执行 f(x, y, z) f, x, y 和 z 的求值发生在当前的 Go 程中&#xff0c;而 f 的执行发生在新的 Go 程中。 Go 程在相同的地址空间中运行&#xff0c…...

VS快捷键大全 | 掌握这些快捷键,助你调试快人一步

欢迎关注博主 Mindtechnist 或加入【Linux C/C/Python社区】一起学习和分享Linux、C、C、Python、Matlab&#xff0c;机器人运动控制、多机器人协作&#xff0c;智能优化算法&#xff0c;滤波估计、多传感器信息融合&#xff0c;机器学习&#xff0c;人工智能等相关领域的知识和…...

【刷题】203. 移除链表元素

203. 移除链表元素 一、题目描述二、示例三、实现方法1-找到前一个节点修改next指向方法2-不是val的尾插重构 总结 203. 移除链表元素 一、题目描述 给你一个链表的头节点 head 和一个整数 val &#xff0c;请你删除链表中所有满足 Node.val val 的节点&#xff0c;并返回 新…...

C++11学习- CPU多核与多线程、并行与并发

随着计算机编程频繁使用&#xff0c;关于CPU的处理性能的讨论从未停止过&#xff0c;由于我最近在学习多线程相关的知识&#xff0c;那么就来理一理CPU的核心问题。 一、线程与进程 业解释 线程是CPU调度和分配的基本单位&#xff0c;可以理解为CPU只看得到线程&#xff1b; …...

docker登录harbor、K8s拉取镜像报http: server gave HTTP response to HTTPS client

docker登录harbor、K8s拉取镜像报http: server gave HTTP response to HTTPS client 当搭建完docker私有仓库后&#xff0c;准备docker login http://ip:端口 登录时会包如下错误 当我们使用docker私有仓库中的镜像在K8s集群中部署应用时会包如下错误 以上错误根据报错信息可…...

Redis在linux下安装

1.下载安装包 redis官网: Download | Redis 2.解压 2.1在目录下解压压缩包 tar -zxvf redis-7.0.11.tar.gz 2.2将redis移至另一目录下并改名为redis mv redis-7.0.11 /usr/local/redis 3.编译 进入到redis目录下&#xff0c;make命令编译 [rootVM-24-15-centos local]# cd…...

这里有你想知道的那些卖家友好型跨境电商平台!

目前市面上的跨境电商平台千千万&#xff0c;想要找到那个最合适的平台其实不容易&#xff0c;而且合适这个定义也有很多不同标准。龙哥今天打算从其中一个标准展开&#xff0c;那就是对卖家的友好程度。我们要做的话可以优先选择一些对卖家友好的平台&#xff0c;无论是方便我…...

架构中如何建设共识

在互联网时代&#xff0c;我们面临着三个与沟通交流相关的重要挑战&#xff1a; 分布式研发&#xff1a;日常工作中相对隔离的微服务研发模式&#xff1b;沟通障碍&#xff1a;分散在全球或全国多地的研发团队&#xff0c;以及由此带来的语言、文化和沟通障碍&#xff1b;认知…...