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

SpringDataJpa源码分析

我们在定义Repository的时候通常定义的时一个接口,而并没有去实现这个接口,那么Jpa是如何让开发者无需自己实现接口就可以使用Repository去操作数据库?
动态代理!!!

Repository原理

试想一下JPA是如何做的?

  1. 通过动态代理将接口实例化成对应的类。
  2. 解析方法名或根据指定的方法名
  3. 并根据得到的结果转换为数据库操作

尝试写一个示例

  • 自定义一个Repository
public interface CustomRepository<T, ID> extends Repository<T, ID> {/*** 查询前num条数据* @param num* @return*/List<T> findByFirst(Long num);
}
  • 对自定义Repository的代理逻辑
/*** @author yuanmengfan(mf.yuan @ qq.com) on 2024/8/7 23:26* 自定义Repository的代理*/
@Data
public class CustomRepositoryInvocationHandler implements InvocationHandler {// 用于操作数据库private EntityManager em;// 知晓操作那个对象private Class<?> entityClass;public CustomRepositoryInvocationHandler(EntityManager em, Class<?> entityClass) {this.em = em;this.entityClass = entityClass;}@Overridepublic Object invoke(Object proxy, Method method, Object[] args) {Object result = null;String name = method.getName();switch (name) {// 根据方法名定义不同操作数据库的逻辑case "findByFirst":CriteriaBuilder cn = em.getCriteriaBuilder();CriteriaQuery query = cn.createQuery(entityClass);Root from = query.from(entityClass);result = em.createQuery(query.select(from)).setMaxResults(Math.toIntExact((Long) args[0])).getResultList();break;}return result;}
}
  • 测试下创建出来的代理对象是否能正常运行
@Testpublic void test() {// 初始化IOC容器AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(JpaConfig.class);LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = applicationContext.getBean(LocalContainerEntityManagerFactoryBean.class);// 创建EntityManagerEntityManager em = localContainerEntityManagerFactoryBean.getNativeEntityManagerFactory().createEntityManager();Class<?> proxyClass = UserCustomRepository.class;// 获取接口泛型信息ParameterizedType parameterizedType = (ParameterizedType) proxyClass.getGenericInterfaces()[0];Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();Class entityClass = (Class) actualTypeArguments[0];Class idClass = (Class) actualTypeArguments[1];// 通过动态代理创建对象UserCustomRepository proxyInstance = (UserCustomRepository) Proxy.newProxyInstance(proxyClass.getClassLoader(), new Class[]{proxyClass}, new CustomRepositoryInvocationHandler(em, entityClass));System.out.println(proxyInstance.findByFirst(5L));}

image.png
已经可以根据我们指定的类型来操作数据库了。

源码跟踪验证

@Test
public void test(){// 初始化IOC容器AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(JpaConfig.class);UserJpaRepository bean = applicationContext.getBean(UserJpaRepository.class);Optional<TUser> byId = bean.findById(5L);
}

能发现这里在IOC容器中的是代理对象。
image.png
可以明显的看出这里是使用的JDK动态代理。
image.png
这里可以看见实际上我们的对象是SimpleJpaRepository
image.png
实际调用findById也是通过EntityManage去操作数据库
image.png

Spring是如何整合Jpa呢?

疑问

怎么知道要注册那些Repository

@ComponentScan+@Component

// 添加 
@ComponentScan(basePackages = "com.mfyuan")
public class JpaConfig{}// 添加
@Component
public interface UserCustomRepository extends CustomRepository<TUser, Long> {}@Test
public void test1() {// 初始化IOC容器AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(JpaConfig.class);// 尝试从容器中获取BeanUserCustomRepository bean = applicationContext.getBean(UserCustomRepository.class);
}

image.png

为什么还是拿不到这个Bean呢?
因为Repository是接口不是类,不会被注册到IOC容器中。在扫描成BeanDefinition是被过滤掉了。
ConfigurationClassParser#doProcessConfigurationClass
ComponentScanAnnotationParser#parse 处理@Component的解析
ClassPathBeanDefinitionScanner#doScan
#findCandidateComponents
#scanCandidateComponents
#isCandidateComponent(metadataReader) 判断是否包含@Component注解
image.png
#isCandidateComponent(sbd) 判断是否为接口或者抽象类
image.png
:::
如何解决不扫描接口的问题呢?

  1. ClassPathBeanDefinitionScanner:自定义一个扫描器(让接口也可以别扫描到)。
  2. BeanDefinitionRegistryPostProcessor:在BeanDefinition注册的过程中可以允许进干预。
    :::
public class CustomClassPathBeanDefinitionScanner extends ClassPathBeanDefinitionScanner {public CustomClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry) {super(registry);// 添加过滤器只扫描实现CustomRepository接口的类}/*** 允许接口被扫描** @param beanDefinition the bean definition to check* @return*/@Overrideprotected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {AnnotationMetadata metadata = beanDefinition.getMetadata();return metadata.isInterface();}
}
@Component
public class CustomBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor {@Overridepublic void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {CustomClassPathBeanDefinitionScanner definitionScanner = new CustomClassPathBeanDefinitionScanner(registry);// 清空原有filter definitionScanner.resetFilters(false);// 添加过滤器只扫描实现CustomRepository接口的类definitionScanner.addIncludeFilter(new AssignableTypeFilter(CustomRepository.class));// 能将 com.mfyuan.repository 下的接口也进行注册了definitionScanner.scan("com.mfyuan.repository");}@Overridepublic void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {BeanDefinitionRegistryPostProcessor.super.postProcessBeanFactory(beanFactory);}
}

到现在我们的接口就可以被扫描成BeanDefinition,但是又遇到一个问题?
image.png
与之前的错误不同的是已经不再提前找不到对应类型的Bean了,而是接口不能实例化的。
:::

如何将对应的Repository接口注入到容器中?

可以将通过动态代理后的对象放入到容器中,这里就解决了接口不能实例化的问题。
但是不可能一个一个去创建动态代理的对象吧,这样想想就很痛苦。
使用FactoryBean来定义创建过程。与前面Repository原理结合。
:::

@Data
public class CustomRepositoryFactoryBean implements FactoryBean {private Class<?> repositoryInterface;@Autowiredprivate LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean;public CustomRepositoryFactoryBean(Class<?> repositoryInterface) {this.repositoryInterface = repositoryInterface;}/*** FactoryBean的特性这个方法的返回值是注册到容器中对象*/@Overridepublic Object getObject() {// 创建EntityManagerEntityManager em = localContainerEntityManagerFactoryBean.getNativeEntityManagerFactory().createEntityManager();// 获取接口泛型信息ParameterizedType parameterizedType = (ParameterizedType) repositoryInterface.getGenericInterfaces()[0];Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();Class<?> entityClass = (Class<?>) actualTypeArguments[0];// Class idClass = (Class) actualTypeArguments[1];// 通过动态代理创建对象return Proxy.newProxyInstance(repositoryInterface.getClassLoader(), new Class[]{repositoryInterface}, new CustomRepositoryInvocationHandler(em, entityClass));}/*** FactoryBean的特性这个方法的返回值是注册到容器的对象类型*/@Overridepublic Class<?> getObjectType() {return repositoryInterface;}
}

重写CustomClassPathBeanDefinitionScanner#doScan 对扫描到的BeanDefinition进行修改

public class CustomClassPathBeanDefinitionScanner extends ClassPathBeanDefinitionScanner {// .....@SneakyThrows@Overrideprotected Set<BeanDefinitionHolder> doScan(String... basePackages) {// 这里拿到的就行自定义扫描器 扫出来的所有BeanDefinitionSet<BeanDefinitionHolder> beanDefinitionHolders = super.doScan(basePackages);for (BeanDefinitionHolder beanDefinitionHolder : beanDefinitionHolders) {ScannedGenericBeanDefinition beanDefinition = (ScannedGenericBeanDefinition) beanDefinitionHolder.getBeanDefinition();// 得到扫描到的repositoryClassString repositoryClassName = beanDefinition.getBeanClassName();// 设置BeanDefinition的Class为FactoryBean// mybatis 这里也是这样做的 只不过是新注册了一个BeanDefinitionbeanDefinition.setBeanClass(CustomRepositoryFactoryBean.class);// 添加一个构造参数beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(repositoryClassName);}return beanDefinitionHolders;}
}

测试

@Test
public void test1() {// 初始化IOC容器AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(JpaConfig.class);// 尝试从容器中获取BeanUserCustomRepository bean = applicationContext.getBean(UserCustomRepository.class);System.out.println(bean.findByFirst(5L));
}

能够走自定义Repository里面的方法了。

image.png解释

CustomRepository:相当于一个顶层接口,他去定义对应的统一的数据库操作。类似JpaRepositoryCrudRepository
CustomRepositoryInvocationHandler:相当于是对顶层接口所有的方法进行了一个实现。类似SimpleJpaRepository

源码验证

// 导入JpaRepositoriesRegistrar
@Import(JpaRepositoriesRegistrar.class)
public @interface EnableJpaRepositories {}// 实现了ImportBeanDefinitionRegistrar就代表有动态注册BeanDefinition的能力
class JpaRepositoriesRegistrar extends RepositoryBeanDefinitionRegistrarSupport {}public abstract class RepositoryBeanDefinitionRegistrarSupportimplements ImportBeanDefinitionRegistrar, ResourceLoaderAware, EnvironmentAware {@Overridepublic void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry,BeanNameGenerator generator) {// ...// 委托RepositoryConfigurationDelegate进行注册RepositoryConfigurationDelegate delegate = new RepositoryConfigurationDelegate(configurationSource, resourceLoader,environment);delegate.registerRepositoriesIn(registry, extension);}@Overridepublic Streamable<BeanDefinition> getCandidates(ResourceLoader loader) {// 定义的扫描器RepositoryComponentProvider scanner = new RepositoryComponentProvider(getIncludeFilters(), registry);scanner.setConsiderNestedRepositoryInterfaces(shouldConsiderNestedRepositories());scanner.setEnvironment(environment);scanner.setResourceLoader(loader);getExcludeFilters().forEach(scanner::addExcludeFilter);// 查找满足条件的组件return Streamable.of(() -> getBasePackages().stream()//.flatMap(it -> scanner.findCandidateComponents(it).stream()));}
}public class RepositoryConfigurationDelegate {// ...public List<BeanComponentDefinition> registerRepositoriesIn(BeanDefinitionRegistry registry,RepositoryConfigurationExtension extension) {Collection<RepositoryConfiguration<RepositoryConfigurationSource>> configurations = extension.getRepositoryConfigurations(configurationSource, resourceLoader, inMultiStoreMode);}
}public abstract class RepositoryConfigurationExtensionSupport implements RepositoryConfigurationExtension {public <T extends RepositoryConfigurationSource> Collection<RepositoryConfiguration<T>> getRepositoryConfigurations(T configSource, ResourceLoader loader, boolean strictMatchesOnly) {// ...// 调用RepositoryBeanDefinitionRegistrarSupport.getCandidates 获得合适的对象for (BeanDefinition candidate : configSource.getCandidates(loader)) {}// ...}
}class RepositoryComponentProvider extends ClassPathScanningCandidateComponentProvider {public RepositoryComponentProvider(Iterable<? extends TypeFilter> includeFilters, BeanDefinitionRegistry registry) {// ....if (includeFilters.iterator().hasNext()) {for (TypeFilter filter : includeFilters) {addIncludeFilter(filter);}} else {// 添加 是Repository接口的类super.addIncludeFilter(new InterfaceTypeFilter(Repository.class));// 添加定义了RepositoryDefinition注解的类super.addIncludeFilter(new AnnotationTypeFilter(RepositoryDefinition.class, true, true));}// 排除带有NoRepositoryBean注解的类addExcludeFilter(new AnnotationTypeFilter(NoRepositoryBean.class));}@Overridepublic Set<BeanDefinition> findCandidateComponents(String basePackage) {// 这里就走到的Spring的findCandidateComponents 里面// 关键的两个方法则是isCandidateComponent(metadataReader) 与 isCandidateComponent(sbd)Set<BeanDefinition> candidates = super.findCandidateComponents(basePackage);// ...}// 这样的话就能将Repository接口及@RepositoryDefinition扫描成BeanDefinition了protected boolean isCandidateComponent(MetadataReader metadataReader) throws IOException {for (TypeFilter tf : this.excludeFilters) {if (tf.match(metadataReader, getMetadataReaderFactory())) {return false;}}for (TypeFilter tf : this.includeFilters) {if (tf.match(metadataReader, getMetadataReaderFactory())) {return isConditionMatch(metadataReader);}}return false;}@Overrideprotected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {boolean isNonRepositoryInterface = !ClassUtils.isGenericRepositoryInterface(beanDefinition.getBeanClassName());boolean isTopLevelType = !beanDefinition.getMetadata().hasEnclosingClass();boolean isConsiderNestedRepositories = isConsiderNestedRepositoryInterfaces();return isNonRepositoryInterface && (isTopLevelType || isConsiderNestedRepositories);}
}public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>, S, ID>implements InitializingBean, RepositoryFactoryInformation<S, ID>, FactoryBean<T>, BeanClassLoaderAware,BeanFactoryAware, ApplicationEventPublisherAware {public void afterPropertiesSet() {// ...// 传入repositoryInterface来得到代理对象this.repository = Lazy.of(() -> this.factory.getRepository(repositoryInterface, repositoryFragmentsToUse));// ...}
}public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, BeanFactoryAware {public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fragments) {// ...// 这里就是最终创建代理对象的地方,会判断是JDK动态代理还是CGLIB代理T repository = (T) result.getProxy(classLoader);// ...return repository;}
}

  1. @EnableJpaRepositories(basePackages = "com.mfyuan.repository")
  2. @Import(JpaRepositoriesRegistrar.class)
  3. JpaRepositoriesRegistrar实现ImportBeanDefinitionRegistrar拥有动态注册的能力与BeanDefinitionRegistryPostProcessor一样
  4. 自定义扫描器RepositoryComponentProvide添加扫描Repository口及RepositoryDefinition注解的includeFilterNoRepositoryBean注解的excludeFilter
  5. 将扫描成功的获选Bean的信息创建成BeanDefinition并修改它的BeanClassName(实际是JpaRepositoryFactoryBean
  6. JpaRepositoryFactoryBean是一个BeanFactory,会为我们创建出一个动态代理的对象并放入到IOC容器中。

相关文章:

SpringDataJpa源码分析

我们在定义Repository的时候通常定义的时一个接口&#xff0c;而并没有去实现这个接口&#xff0c;那么Jpa是如何让开发者无需自己实现接口就可以使用Repository去操作数据库&#xff1f; 动态代理&#xff01;&#xff01;&#xff01; Repository原理 试想一下JPA是如何做的…...

卷积神经网络 - 卷积神经网络与深度学习的历史篇

序言 卷积神经网络&#xff08; Convolutional Neural Networks, CNN \text{Convolutional Neural Networks, CNN} Convolutional Neural Networks, CNN&#xff09;与深度学习作为人工智能领域的两大重要分支&#xff0c;其发展历程充满了探索与突破。深度学习&#xff0c;作…...

初识 Floodfall 算法

文章目录 **一、Floodfall 算法的概述****二、深度优先搜索&#xff08;DFS&#xff09;和广度优先搜索&#xff08;BFS&#xff09;在 Floodfall 算法中的应用****三、算法的基本原理****四、应用场景** 一、Floodfall 算法的概述 Floodfall 算法通常用于解决与区域填充、图的…...

[Linux] LVM挂载的硬盘重启就掉的问题解决

问题&#xff1a;系统重启后挂在逻辑卷的盘会掉&#xff08;必现&#xff09; 环境&#xff1a;SUSE Linux 11 SP4 原因&#xff1a;boot.lvm是关闭的 解决&#xff1a;boot.lvm设置开启 参考资料&#xff1a; linux下lvm状态Not avaliable问题排查及处理(常见Suse操作系统…...

YOLOv8改进 | 主干网络 | 用EfficientNet卷积替换backbone【教程+代码 】

秋招面试专栏推荐 :深度学习算法工程师面试问题总结【百面算法工程师】——点击即可跳转 💡💡💡本专栏所有程序均经过测试,可成功执行💡💡💡 专栏目录 :《YOLOv8改进有效涨点》专栏介绍 & 专栏目录 | 目前已有80+篇内容,内含各种Head检测头、损失函数Loss、…...

数据库规范化设计 5大基本原则

规范化设计原则是数据库设计的基本原则&#xff0c;有助于减少数据冗余&#xff0c;提高数据一致性和完整性&#xff0c;简化数据管理&#xff0c;增强数据安全性&#xff0c;对整个开发项目至关重要。而缺乏规范化设计会导致数据冗余&#xff0c;增加存储成本&#xff0c;引发…...

【nginx】解决k8s中部署nginx转发不会自动更新域名解析启动失败的问题

文章目录 1. 问题2.解决办法3.扩展说明3.1 DNS解析阶段划分3.2 问题说明3.2.1 先看/etc/resolv.conf说明3.2.2 针对第一个问题3.2.3 针对第二个问题 【后端】NginxluaOpenResty高性能实践 参考&#xff1a; https://blog.csdn.net/u010837612/article/details/123275026 1. 问…...

LeetCode637 二叉树的层平均值

前言 题目&#xff1a; 637. 二叉树的层平均值 文档&#xff1a; 代码随想录——二叉树的层平均值 编程语言&#xff1a; C 解题状态&#xff1a; 求取平均值的时候出现了点问题 思路 C中&#xff0c;浮点数的相加会产生精度误差&#xff0c;求取平均值时最好只在最后一步进行…...

王学岗ASM

服务发现 package com.example.testasm;import android.content.Context; import android.os.Bundle;import androidx.activity.EdgeToEdge; import androidx.appcompat.app.AppCompatActivity; import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat;…...

【数据结构】—— 队列

1、队列的概念2、队列的结构如何选择合适的数据结构实现队列&#xff08;数组or链表&#xff09; 3、队列的链式存储3.1 队列的链式存储结构3.2 队列的常见接口3.3 队列的接口实现初始化判空入队列出队列获取队头元素获取队尾元素获取节点个数销毁 3.4 源代码 4、队列的顺序存储…...

vue中openlayers过滤高亮显示某个图层

vue中openlayers过滤高亮显示某个图层 openlayers库没有直接支持这样设置&#xff0c;所以可以使用库&#xff1a;ol-ext&#xff0c;地址&#xff1a;https://viglino.github.io/ol-ext/examples/filter/map.filter.crop.html 效果&#xff1a; 关键代码&#xff1a; /**…...

WPF篇(11)-ToolTip控件(提示工具)+Popup弹出窗口

ToolTip控件 ToolTip控件继承于ContentControl&#xff0c;它不能有逻辑或视觉父级&#xff0c;意思是说它不能以控件的形式实例化&#xff0c;它必须依附于某个控件。因为它的功能被设计成提示信息&#xff0c;当鼠标移动到某个控件上方时&#xff0c;悬停一会儿&#xff0c;…...

【mysql 第一篇章】系统和数据库的交互方法

一、宏观的查看系统怎么和数据库交互 在我们刚刚接触系统和数据库的时候不明白其中的原理&#xff0c;只知道系统和数据库是需要交互的。所以我们会理解成上图的形式。 二、MYSQL 驱动 随着我们的学习时间的加长以及对程序的了解&#xff0c;发现链接数据库是需要有别的工具辅…...

数据结构-位运算总结

位运算总结&#xff1a; 1.求位1的个数 191. 位1的个数 - 力扣&#xff08;LeetCode&#xff09; 有两种写法&#xff1a; 1.是把该数不断的去与0x1相与&#xff0c;得到该数的最后一位的值&#xff0c;然后判断他是不是1&#xff0c;再把该数更新一下整体往后移动一位也就…...

java 异常堆栈的由来

编写的程序代码内部错误产生的异常&#xff0c;如调用对象为空(空指针异常)、数组越界异常、除0异常等。这种通常称为未检查的异常&#xff08;Runtime异常子类&#xff09;&#xff0c;在虚拟机中执行时会集中处理这些异常。其他运行中异常&#xff0c;通过throw语句主动抛出的…...

【推荐系统】【多任务学习】Progressive Layered Extraction (PLE)

Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations 文章目录 Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations1 论文出处2 背景2.1 背景介…...

java -转win32/win64免安装jre环境运行

由于java 转为exe&#xff0c;只能在装有JDK环境的电脑运行&#xff0c; 发给其他人也不能运行&#xff0c;缺少环境&#xff0c;程序自己背着jre走 1.先打好jar 包 2.使用exe4j 把jar包转成exe 运行程序 3.使用inno stup &#xff0c;把exe运行程序加上jre环境 以下是具体实现…...

算法板子:容斥原理——求出 1∼n 中能被质数 p1,p2,…,pm 中的至少一个数整除的整数有多少个

1. 题目要点 1. 设&#xff1a;求1~10中能被质数2和3中至少一个数整除的数有多少个。1~10中能被质数2整除的数的集合记为S1{2,4,6,8,10}&#xff0c;能被质数3整除的数的集合记为S2{3,6,9}&#xff0c;能同时被质数2和3整数的数的集合为S1∩S2{6} 2. 这道题的目的是求S1∪S2∪S…...

用gurobipy求解带不等式约束条件的优化问题

1. 引入 在当今的数据驱动世界中&#xff0c;优化问题无处不在&#xff0c;从工程设计到经济模型&#xff0c;再到机器学习算法的调参&#xff0c;优化都是实现效率最大化、成本最小化或性能最优化的关键工具。 这里有一个典型的数学优化问题&#xff0c;目标是在给定的约束条…...

漏洞复现-Adobe ColdFusion 远程代码执行漏洞(CVE-2023-38203)

1.漏洞描述 Adobe ColdFusion是一种服务器端的Web应用开发平台。它由Adobe Systems开发&#xff0c;用于创建动态的、交互式的Web应用程序和网站。 Adobe ColdFusion在2018u17及之前版本、2021u7及之前版本和2023u1及之前版本中存在任意代码执行漏洞。该漏洞是由于反序列化不…...

XML Group端口详解

在XML数据映射过程中&#xff0c;经常需要对数据进行分组聚合操作。例如&#xff0c;当处理包含多个物料明细的XML文件时&#xff0c;可能需要将相同物料号的明细归为一组&#xff0c;或对相同物料号的数量进行求和计算。传统实现方式通常需要编写脚本代码&#xff0c;增加了开…...

Oracle查询表空间大小

1 查询数据库中所有的表空间以及表空间所占空间的大小 SELECTtablespace_name,sum( bytes ) / 1024 / 1024 FROMdba_data_files GROUP BYtablespace_name; 2 Oracle查询表空间大小及每个表所占空间的大小 SELECTtablespace_name,file_id,file_name,round( bytes / ( 1024 …...

土地利用/土地覆盖遥感解译与基于CLUE模型未来变化情景预测;从基础到高级,涵盖ArcGIS数据处理、ENVI遥感解译与CLUE模型情景模拟等

&#x1f50d; 土地利用/土地覆盖数据是生态、环境和气象等诸多领域模型的关键输入参数。通过遥感影像解译技术&#xff0c;可以精准获取历史或当前任何一个区域的土地利用/土地覆盖情况。这些数据不仅能够用于评估区域生态环境的变化趋势&#xff0c;还能有效评价重大生态工程…...

服务器--宝塔命令

一、宝塔面板安装命令 ⚠️ 必须使用 root 用户 或 sudo 权限执行&#xff01; sudo su - 1. CentOS 系统&#xff1a; yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh2. Ubuntu / Debian 系统…...

uniapp 开发ios, xcode 提交app store connect 和 testflight内测

uniapp 中配置 配置manifest 文档&#xff1a;manifest.json 应用配置 | uni-app官网 hbuilderx中本地打包 下载IOS最新SDK 开发环境 | uni小程序SDK hbulderx 版本号&#xff1a;4.66 对应的sdk版本 4.66 两者必须一致 本地打包的资源导入到SDK 导入资源 | uni小程序SDK …...

给网站添加live2d看板娘

给网站添加live2d看板娘 参考文献&#xff1a; stevenjoezhang/live2d-widget: 把萌萌哒的看板娘抱回家 (ノ≧∇≦)ノ | Live2D widget for web platformEikanya/Live2d-model: Live2d model collectionzenghongtu/live2d-model-assets 前言 网站环境如下&#xff0c;文章也主…...

嵌入式常见 CPU 架构

架构类型架构厂商芯片厂商典型芯片特点与应用场景PICRISC (8/16 位)MicrochipMicrochipPIC16F877A、PIC18F4550简化指令集&#xff0c;单周期执行&#xff1b;低功耗、CIP 独立外设&#xff1b;用于家电、小电机控制、安防面板等嵌入式场景8051CISC (8 位)Intel&#xff08;原始…...

沙箱虚拟化技术虚拟机容器之间的关系详解

问题 沙箱、虚拟化、容器三者分开一一介绍的话我知道他们各自都是什么东西&#xff0c;但是如果把三者放在一起&#xff0c;它们之间到底什么关系&#xff1f;又有什么联系呢&#xff1f;我不是很明白&#xff01;&#xff01;&#xff01; 就比如说&#xff1a; 沙箱&#…...

篇章二 论坛系统——系统设计

目录 2.系统设计 2.1 技术选型 2.2 设计数据库结构 2.2.1 数据库实体 1. 数据库设计 1.1 数据库名: forum db 1.2 表的设计 1.3 编写SQL 2.系统设计 2.1 技术选型 2.2 设计数据库结构 2.2.1 数据库实体 通过需求分析获得概念类并结合业务实现过程中的技术需要&#x…...

Spring AOP代理对象生成原理

代理对象生成的关键类是【AnnotationAwareAspectJAutoProxyCreator】&#xff0c;这个类继承了【BeanPostProcessor】是一个后置处理器 在bean对象生命周期中初始化时执行【org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization】方法时…...