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

做网站怎么防止被黑/百度推广管理系统

做网站怎么防止被黑,百度推广管理系统,十大电子商务平台,湘潭网络营销关于Autowired注解的作用 Autowired 注解在Spring中的作用是实现依赖注入(Dependency Injection),它用于自动装配(autowiring)Spring Bean 的依赖关系。具体来说, Autowired 注解有以下作用: …

关于@Autowired注解的作用

@Autowired 注解在Spring中的作用是实现依赖注入(Dependency Injection),它用于自动装配(autowiring)Spring Bean 的依赖关系。具体来说, @Autowired 注解有以下作用:

  1. 自动装配依赖:通过在类的字段、构造函数、方法参数等地方使用 @Autowired 注解,Spring 容器会自动识别需要注入的依赖,并将适当的 Bean 实例注入到目标组件中。
  2. 减少手动配置:使用 @Autowired 注解可以减少手动配置依赖关系的工作,因为它会自动发现并管理组件之间的依赖关系,从而降低了配置的复杂性。
  3. 提高可维护性@Autowired 注解明确地标识了类的依赖关系,使代码更易于理解和维护,因为它清晰地表达了组件之间的关联。
  4. 解耦:通过将依赖项的注入交给 Spring 容器处理,实现了松散耦合,使组件更容易替换、扩展和测试,同时降低了组件之间的耦合度。
  5. 支持多种装配模式@Autowired 提供了多种装配模式,包括按类型、按名称、按限定符(qualifier)等方式,以满足不同的装配需求。

Spring Framework与@Autowired

在Spring Framework框架中最重要的概念是IoC和DI,通过这两个特性可以实现对象间的依赖关系由框架管理,构造对象间的依赖关系,将依赖对象自动注入到需要它们的类中,在使用时无需手动创建或查找依赖对象,注入依赖关系主要有以下方法:

  • 通过xml配置注入
  • 通过@Autowired等注解注入
  • 当前Spring Framework推荐的通过构造方法注入

无论何种注入方法,Spring都会获取该Bean配置的元数据(Bean定义和依赖关系),那么接下来我将从源码层面分析@Autowired注入依赖的过程。

Bean创建过程

doCreateBean-创建Bean实例

	/*** Central method of this class: creates a bean instance,* populates the bean instance, applies post-processors, etc.* @see #doCreateBean*/@Overrideprotected Object createBean(String beanName, RootBeanDefinition mbd, @Nullable Object[] args)throws BeanCreationException {//省略其他代码,展示主要流程try {Object beanInstance = doCreateBean(beanName, mbdToUse, args);if (logger.isTraceEnabled()) {logger.trace("Finished creating instance of bean '" + beanName + "'");}return beanInstance;}catch (BeanCreationException | ImplicitlyAppearedSingletonException ex) {// A previously detected exception with proper bean creation context already,// or illegal singleton state to be communicated up to DefaultSingletonBeanRegistry.throw ex;}catch (Throwable ex) {throw new BeanCreationException(mbdToUse.getResourceDescription(), beanName, "Unexpected exception during bean creation", ex);}}

创建Bean方法的主要逻辑在doCreateBean中,Spring Framework通过doCreateBean创建指定Bean,在该方法中,其中通过populateBean()遍历对应后置处理器,即:一个被注解标注的类被注入到Spring容器时,首先会创建Bean对象,创建后调用populateBean方法以遍历后置处理器通过后置处理器获取到需要的value,将@Autowired注解中的属性(元数据)赋值到Bean中。

populateBean-遍历后置处理器

// Give any InstantiationAwareBeanPostProcessors the opportunity to modify the//InstantiationAwareBeanPostProcessors可以为@Autowired注解提供后置处理,// state of the bean before properties are set. This can be used, for example,// to support styles of field injection.if (!mbd.isSynthetic() && hasInstantiationAwareBeanPostProcessors()) {//遍历所有相关后置处理器,获取需要的valuefor (InstantiationAwareBeanPostProcessor bp : getBeanPostProcessorCache().instantiationAware) {if (!bp.postProcessAfterInstantiation(bw.getWrappedInstance(), beanName)) {return;}}}}

 

@Autowired注解所需的后置处理器是:AutowiredAnnotationBeanPostProcessor。接下来Spring容器开始使用该注解的后置处理器去获取对应的属性value,假设我们不知道@Autowired注解对应后置处理器的逻辑,那么根据这个需求来猜测后置处理器中的相关逻辑的方法名:需要带有处理、属性,那么对应的单词就是:Process、Properties,对应找一下,postProcessProperties()便是目标方法。

@Override
public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName) {//根据BeanName获取注入的元数据InjectionMetadata metadata = findAutowiringMetadata(beanName, bean.getClass(), pvs);try {//元数据Value注入目标Bean中metadata.inject(bean, beanName, pvs);}catch (BeanCreationException ex) {throw ex;}catch (Throwable ex) {throw new BeanCreationException(beanName, "Injection of autowired dependencies failed", ex);}return pvs;
}

获取注入的元数据

 
//用于缓存Spring解析过的Bean元数据
private final Map<String, InjectionMetadata> injectionMetadataCache = new ConcurrentHashMap<>(256);

	private InjectionMetadata findAutowiringMetadata(String beanName, Class<?> clazz, @Nullable PropertyValues pvs) {// Fall back to class name as cache key, for backwards compatibility with custom callers.String cacheKey = (StringUtils.hasLength(beanName) ? beanName : clazz.getName());// 查询缓存中是否存在对应元数据-Quick check on the concurrent map first, with minimal locking.InjectionMetadata metadata = this.injectionMetadataCache.get(cacheKey);if (InjectionMetadata.needsRefresh(metadata, clazz)) {synchronized (this.injectionMetadataCache) {metadata = this.injectionMetadataCache.get(cacheKey);if (InjectionMetadata.needsRefresh(metadata, clazz)) {if (metadata != null) {metadata.clear(pvs);}//当缓存中不存在指定Bean的MetaData时,构建MetaDatametadata = buildAutowiringMetadata(clazz);this.injectionMetadataCache.put(cacheKey, metadata);}}}return metadata;}

 

如何构造Metadata

Spring Framework通过buildAutowiringMetadata()方法解析注解中的数据。

//需要解析的注解结合
private final Set<Class<? extends Annotation>> autowiredAnnotationTypes = new LinkedHashSet<>(4);if (!AnnotationUtils.isCandidateClass(clazz, this.autowiredAnnotationTypes)) {return InjectionMetadata.EMPTY;
}
/*** Create a new {@code AutowiredAnnotationBeanPostProcessor} for Spring's* standard {@link Autowired @Autowired} and {@link Value @Value} annotations.* <p>Also supports JSR-330's {@link javax.inject.Inject @Inject} annotation,* if available.* 为 Spring 的标准@Autowired和@Value注释创建一个新的AutowiredAnnotationBeanPostProcessor*/@SuppressWarnings("unchecked")public AutowiredAnnotationBeanPostProcessor() {this.autowiredAnnotationTypes.add(Autowired.class);this.autowiredAnnotationTypes.add(Value.class);try {this.autowiredAnnotationTypes.add((Class<? extends Annotation>)ClassUtils.forName("javax.inject.Inject", AutowiredAnnotationBeanPostProcessor.class.getClassLoader()));logger.trace("JSR-330 'javax.inject.Inject' annotation found and supported for autowiring");}catch (ClassNotFoundException ex) {// JSR-330 API not available - simply skip.}}

这段代码首先会调用 isCandidateClass 方法判断当前类是否为一个候选类,判断的依据就是 类、属性、方法上是否包含autowiredAnnotationTypes 集合中初始化的值(@Autowired@Value@Inject),当Bean的定义中包含集合中对应类型的注解时,被判定为候选类,再去获取该类对应注解中的元数据。

如果Bean中没有没有指定类型的注解时,返回一个空的元数据注入对象。如果有指定注解,则开始获取注解中的元数据。

获取元数据的方式,是通过反射实现的。以下是通过反射获取类、属性、方法中对应注解的逻辑。

以DruidDataSourceWrapper为例:

通过反射获取指定类的字段中的属性

private InjectionMetadata buildAutowiringMetadata(final Class<?> clazz) {if (!AnnotationUtils.isCandidateClass(clazz, this.autowiredAnnotationTypes)) {return InjectionMetadata.EMPTY;}List<InjectionMetadata.InjectedElement> elements = new ArrayList<>();Class<?> targetClass = clazz;do {final List<InjectionMetadata.InjectedElement> currElements = new ArrayList<>();//通过反射获取指定类的字段中的属性ReflectionUtils.doWithLocalFields(targetClass, field -> {MergedAnnotation<?> ann = findAutowiredAnnotation(field);if (ann != null) {if (Modifier.isStatic(field.getModifiers())) {if (logger.isInfoEnabled()) {logger.info("Autowired annotation is not supported on static fields: " + field);}return;}boolean required = determineRequiredStatus(ann);currElements.add(new AutowiredFieldElement(field, required));}});}

 

以DruidDataSource为例

通过反射获取指定类的方法中的属性

         //通过反射获取指定类的方法中的属性ReflectionUtils.doWithLocalMethods(targetClass, method -> {Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(method);if (!BridgeMethodResolver.isVisibilityBridgeMethodPair(method, bridgedMethod)) {return;}MergedAnnotation<?> ann = findAutowiredAnnotation(bridgedMethod);if (ann != null && method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {if (Modifier.isStatic(method.getModifiers())) {if (logger.isInfoEnabled()) {logger.info("Autowired annotation is not supported on static methods: " + method);}return;}if (method.getParameterCount() == 0) {if (logger.isInfoEnabled()) {logger.info("Autowired annotation should only be used on methods with parameters: " +method);}}boolean required = determineRequiredStatus(ann);PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz);currElements.add(new AutowiredMethodElement(method, required, pd));}});

 

 

元数据注入

从缓存中获取值

AutowiredAnnotationBeanPostProcessor类中的inject方法用来注入元数据。

该方法会首先从缓存中获取元数据,如果缓存中没有,则执行resolvedCachedArgument解析字段值。

		@Overrideprotected void inject(Object bean, @Nullable String beanName, @Nullable PropertyValues pvs) throws Throwable {Field field = (Field) this.member;Object value;if (this.cached) {try {value = resolvedCachedArgument(beanName, this.cachedFieldValue);}catch (NoSuchBeanDefinitionException ex) {// Unexpected removal of target bean for cached argument -> re-resolvevalue = resolveFieldValue(field, bean, beanName);}}else {value = resolveFieldValue(field, bean, beanName);}if (value != null) {ReflectionUtils.makeAccessible(field);field.set(bean, value);}}

 解析字段值

@Nullable
private ConfigurableListableBeanFactory beanFactory;@Nullableprivate Object resolveFieldValue(Field field, Object bean, @Nullable String beanName) {DependencyDescriptor desc = new DependencyDescriptor(field, this.required);desc.setContainingClass(bean.getClass());Set<String> autowiredBeanNames = new LinkedHashSet<>(1);Assert.state(beanFactory != null, "No BeanFactory available");TypeConverter typeConverter = beanFactory.getTypeConverter();Object value;try {//解析核心方法value = beanFactory.resolveDependency(desc, beanName, autowiredBeanNames, typeConverter);}catch (BeansException ex) {throw new UnsatisfiedDependencyException(null, beanName, new InjectionPoint(field), ex);}synchronized (this) {if (!this.cached) {Object cachedFieldValue = null;if (value != null || this.required) {cachedFieldValue = desc;registerDependentBeans(beanName, autowiredBeanNames);if (autowiredBeanNames.size() == 1) {String autowiredBeanName = autowiredBeanNames.iterator().next();if (beanFactory.containsBean(autowiredBeanName) &&beanFactory.isTypeMatch(autowiredBeanName, field.getType())) {cachedFieldValue = new ShortcutDependencyDescriptor(desc, autowiredBeanName, field.getType());}}}this.cachedFieldValue = cachedFieldValue;this.cached = true;}}return value;}

DependencyDescriptor:表示和处理Bean之间的依赖关系。

resolveDependency方法是接口BeanFactory接口提供的,DefaultListableBeanFactory是BeanFactory的一个实现类。

resolveDependency方法用于解析和解决依赖关系,该方法的作用是根据给定的 DependencyDescriptor 对象,解析并返回不同类型的依赖对象,当前方法最终会走doResolveDependency

@Override
@Nullable
public Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName,@Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) throws BeansException {descriptor.initParameterNameDiscovery(getParameterNameDiscoverer());if (Optional.class == descriptor.getDependencyType()) {return createOptionalDependency(descriptor, requestingBeanName);}else if (ObjectFactory.class == descriptor.getDependencyType() ||ObjectProvider.class == descriptor.getDependencyType()) {return new DependencyObjectProvider(descriptor, requestingBeanName);}else if (javaxInjectProviderClass == descriptor.getDependencyType()) {return new Jsr330Factory().createDependencyProvider(descriptor, requestingBeanName);}else {Object result = getAutowireCandidateResolver().getLazyResolutionProxyIfNecessary(descriptor, requestingBeanName);if (result == null) {result = doResolveDependency(descriptor, requestingBeanName, autowiredBeanNames, typeConverter);}return result;}
}

doResolveDependency方法

			Object multipleBeans = resolveMultipleBeans(descriptor, beanName, autowiredBeanNames, typeConverter);if (multipleBeans != null) {return multipleBeans;}Map<String, Object> matchingBeans = findAutowireCandidates(beanName, type, descriptor);if (matchingBeans.isEmpty()) {if (isRequired(descriptor)) {raiseNoMatchingBeanFound(type, descriptor.getResolvableType(), descriptor);}return null;}String autowiredBeanName;Object instanceCandidate;if (matchingBeans.size() > 1) {autowiredBeanName = determineAutowireCandidate(matchingBeans, descriptor);if (autowiredBeanName == null) {if (isRequired(descriptor) || !indicatesMultipleBeans(type)) {return descriptor.resolveNotUnique(descriptor.getResolvableType(), matchingBeans);}else {// In case of an optional Collection/Map, silently ignore a non-unique case:// possibly it was meant to be an empty collection of multiple regular beans// (before 4.3 in particular when we didn't even look for collection beans).return null;}}instanceCandidate = matchingBeans.get(autowiredBeanName);}else {// We have exactly one match.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) {instanceCandidate = descriptor.resolveCandidate(autowiredBeanName, type, this);}Object result = instanceCandidate;if (result instanceof NullBean) {if (isRequired(descriptor)) {raiseNoMatchingBeanFound(type, descriptor.getResolvableType(), descriptor);}result = null;}if (!ClassUtils.isAssignableValue(type, result)) {throw new BeanNotOfRequiredTypeException(autowiredBeanName, type, instanceCandidate.getClass());}return result;}finally {ConstructorResolver.setCurrentInjectionPoint(previousInjectionPoint);}
  • resolveMultipleBean:见名知意, 解析多个Bean,在注入时,当前类中能有不同类型的Bean,如Bean、数组、集合、Map等,该方法针对不同类型的Bean查找返回。
  • findAutowireCandidates:查找满足条件的Bean,该方法查找出来的Bean可能有一个或多个。

以上,完成了满足条件的候选对象列表并注入。

相关文章:

深入解析 Spring Framework 中 @Autowired 注解的实现原理

关于Autowired注解的作用 Autowired 注解在Spring中的作用是实现依赖注入&#xff08;Dependency Injection&#xff09;&#xff0c;它用于自动装配&#xff08;autowiring&#xff09;Spring Bean 的依赖关系。具体来说&#xff0c; Autowired 注解有以下作用&#xff1a; …...

电脑数据文件恢复工具easyrecovery14中文版

当不小心将回收站的文件删除了怎么办&#xff1f;想找回但是不知道怎么找回需要的数据文件&#xff1f;别担心今天小编就为大家介绍一款非常专业的电脑数据文件恢复工具&#xff0c;easyrecovery14是由Ontrack专为电脑用户推出的一款专业的数据恢复软件&#xff0c;这款软件功能…...

Android NDK开发详解之Application.mk探秘

Android NDK开发详解之Application.mk探秘 概览变量APP_ASFLAGSAPP_ASMFLAGSAPP_BUILD_SCRIPTAPP_CFLAGSAPP_CLANG_TIDYAPP_CLANG_TIDY_FLAGSAPP_CONLYFLAGSAPP_CPPFLAGSAPP_CXXFLAGSAPP_DEBUGAPP_LDFLAGSAPP_MANIFESTAPP_MODULESAPP_OPTIMAPP_PLATFORMAPP_PROJECT_PATHAPP_STL…...

(草履虫都可以看懂的)PyQt子窗口向主窗口传递参数,主窗口接收子窗口信号、参数。

子窗口向主窗口发射信号。 只需要插入两行代码 class CodeSettingWindow(Ui_CodeSetting, QMainWindow):_signal pyqtSignal(int, int, int) # 这个信号要放在class之下&#xff0c;———init————函数上def __init__(self):# self.Win_X, self.Win_Y, self.CodeNum表示…...

Golang Web3钱包开发指南

简介 以太坊&#xff08;Ethereum&#xff09;是目前最受欢迎的区块链平台之一&#xff0c;它提供了智能合约功能和去中心化应用&#xff08;DApps&#xff09;的开发能力。在以太坊生态系统中&#xff0c;Web3钱包扮演着关键角色&#xff0c;允许用户管理账户和密钥、发送交易…...

Vue使用 IndexDB vue操作IndexDB数据库 Vue操作IndexDB数据库

Vue使用 IndexDB vue操作IndexDB数据库 Vue操作IndexDB数据库 Vue使用 IndexDB vue操作IndexDB数据库 Vue操作IndexDB数据库安装 IndexDB类库引入 localForage测试 新增数据、获取数据 Vue使用 IndexDB vue操作IndexDB数据库 Vue操作IndexDB数据库 大部分场景使用 LocalStore都…...

CentOS 安装 Hadoop Local (Standalone) Mode 单机模式

CentOS 安装 Hadoop Local (Standalone) Mode 单机模式 Hadoop Local (Standalone) Mode 单机模式 1. 修改yum源 并升级内核和软件 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repoyum clean allyum makecacheyum -y update2. 安…...

jenkins工具系列 —— 删除Jenkins JOB后清理workspace

文章目录 问题现象分析解决思路脚本实现问题现象分析 Jenkins使用过程中,占用空间最大的两个位置: 1 、workspace: 工作空间,可以随便删除,删除后再次构建时间可能会比较长,因为要重新获取一些资源。 2 、job: 存放的是项目的配置、构建结果、日志等。不建议手动删除,…...

超越人眼,好用的OCR软件推荐

OCR技术&#xff08;Optical Character Recognition&#xff09;是一种将图像或扫描的文字转化为可编辑、搜索、存储、分享的文本的技术。OCR技术除了能够将纸质文档数字化&#xff0c;还可以将手写文本、印刷文本、数码照片中的文字等转化为电子文本。 以下是几个比较知名的O…...

Go语言开发网站

引言 随着互联网的迅速发展&#xff0c;网站已经成为人们获取各种信息和服务的主要途径。而开发一个高性能、可扩展的网站是一项挑战。Go语言作为一门现代化的编程语言&#xff0c;具有强大的并发能力和高效的性能&#xff0c;逐渐成为网站开发的首选语言之一。本文将介绍如何…...

第18章_MySQL8其它新特性

第18章_MySQL8其它新特性 讲师&#xff1a;尚硅谷-宋红康&#xff08;江湖人称&#xff1a;康师傅&#xff09; 官网&#xff1a;http://www.atguigu.com 1. MySQL8新特性概述 MySQL从5.7版本直接跳跃发布了8.0版本&#xff0c;可见这是一个令人兴奋的里程碑版本。MySQL 8版…...

Python爬虫实战(六)——使用代理IP批量下载高清小姐姐图片(附上完整源码)

文章目录 一、爬取目标二、实现效果三、准备工作四、代理IP4.1 代理IP是什么&#xff1f;4.2 代理IP的好处&#xff1f;4.3 获取代理IP4.4 Python获取代理IP 五、代理实战5.1 导入模块5.2 设置翻页5.3 获取图片链接5.4 下载图片5.5 调用主函数5.6 完整源码5.7 免费代理不够用怎…...

【操作系统】考研真题攻克与重点知识点剖析 - 第 1 篇:操作系统概述

前言 本文基础知识部分来自于b站&#xff1a;分享笔记的好人儿的思维导图与王道考研课程&#xff0c;感谢大佬的开源精神&#xff0c;习题来自老师划的重点以及考研真题。此前我尝试了完全使用Python或是结合大语言模型对考研真题进行数据清洗与可视化分析&#xff0c;本人技术…...

Mac删除照片快捷键ctrl加什么 Mac电脑如何批量删除照片

Mac电脑是很多人喜欢使用的电脑&#xff0c;它有着优美的设计、高效的性能和丰富的功能。如果你的Mac电脑上存储了很多不需要的照片&#xff0c;那么你可能会想要删除它们&#xff0c;以节省空间和提高速度。那么&#xff0c;Mac删除照片快捷键ctrl加什么呢&#xff1f;Mac电脑…...

数据安全认证:保护您的数据安全的关键步骤

随着信息技术的飞速发展&#xff0c;数据安全问题日益凸显。数据泄露、网络攻击等事件频发&#xff0c;给企业和个人带来极大的损失。因此&#xff0c;数据安全认证成为保护数据安全的重要措施。本文将探讨数据安全认证的重要性、认证流程和相关标准&#xff0c;以期帮助读者更…...

表白墙/留言墙 —— 初级SpringBoot项目,练手项目前后端开发(带完整源码) 全方位全步骤手把手教学

&#x1f9f8;欢迎来到dream_ready的博客&#xff0c;&#x1f4dc;相信你对这篇博客也感兴趣o (ˉ▽ˉ&#xff1b;) 用户登录前后端开发(一个简单完整的小项目)——SpringBoot与session验证&#xff08;带前后端源码&#xff09;全方位全流程超详细教程 目录 项目前端页面展…...

【海德教育】报考建筑八大员需要满足下列条件:

1 、初级(具备以下条塌氏件之一) ( 1 )本专业或相关专业中专以上学历竖陆。 ( 2 )从事本职业工作 2 年以上。 2 、中级(具备以下条件之一) ( 1 )本专业或相关专业大专以上学历。 ( 2 )连续从事本职业工作 4 年以上。 ( 3 )取得余衫顷本职业初级证书&#xff0c;从事本职业工作 …...

酷开科技,让家庭更有温度!

生活中总有一些瞬间&#xff0c;会让我们感到无比温暖和幸福。一个拥抱、一句问候、一杯热茶&#xff0c;都能让我们感受到家庭的温馨和关爱。酷开科技也用自己的方式为我们带来了独属于科技的温暖&#xff0c;通过全新的体验将消费者带进一个充满惊喜的世界&#xff0c;让消费…...

九州未来入选“2023边缘计算产业图谱”三大细分领域

10月26日&#xff0c;边缘计算社区正式发布《2023边缘计算产业图谱》&#xff0c;九州未来凭借深厚的技术积累、优秀的产品服务、完善的产品解决方案体系以及开源贡献&#xff0c;实力入选图谱——边缘计算平台、边缘计算开源、边缘云服务提供商三大细分领域&#xff0c;充分彰…...

centos ubantu IP一直变化,远程连接不上问题

文章目录 一、为什么IP地址会变1.主机DHCP导致 二、解决IP地址变化1.centos2.ubantu 总结 虚拟机能连接为互联网,但下一次启动IP地址再发生变化,无法使用ssh远程连接 一、为什么IP地址会变 1.主机DHCP导致 虚拟机系统(ubantu,centos…)启动后会向本地申请IP地址租约,租聘的I…...

多线程---JUC

文章目录 什么是JUC&#xff1f;Callable接口ReentrantLockReentrantLock VS synchronized 原子类线程池信号量SemaphoreCountDownLatch 什么是JUC&#xff1f; JUC是&#xff1a;java.util.concurrent这个包名的缩写。它里面包含了与并发相关&#xff0c;即与多线程相关的很多…...

事务隔离级别

隔离级别 概念理解 事务的概念 事务是数据库管理系统中的一个基本单位&#xff0c;它代表了一组数据库操作。 事务是一个不可分割的工作单元&#xff0c;要么全部成功执行&#xff0c;要么全部失败回滚。 事务的目标是确保数据库的一致性、隔离性、持久性和原子性&#xff…...

centos7安装配置及Linux常用命令

目录 一.centos7的安装 1.1centos7的简介 1.2步骤 ​编辑 1.3登录 ​编辑 1.4MobaXterm使用 二.Linux常用命令&模式 1.1 常用命令 1.2 三种模式 命令模式 编辑模式 末行模式 1.3 命令使用&换源 换源 1.4 拍照备份 一.centos7的安装 1.1centos7的简…...

C语言调用lua

C语言是一种非常流行的编程语言&#xff0c;而Lua是一种基于C语言开发的脚本语言。相信大家都知道&#xff0c;Lua可以使用C语言来扩展其功能&#xff0c;进而实现更复杂的功能。而在Lua的各种实现中&#xff0c;luajit也是其中一种非常流行的实现。在本篇博客中&#xff0c;我…...

算法通关村第十二关黄金挑战——最长公共前缀问题解析

大家好&#xff0c;我是怒码少年小码。 最长公共前缀 LeetCode 14&#xff1a;编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀&#xff0c;返回空字符串 “”。 示例&#xff1a; 输入&#xff1a;strs [“flower”,“flow”,“flight”]输出&#xff…...

Python运维学习Day02-subprocess/threading/psutil

文章目录 1. 检测网段在线主机2. 获取系统变量的模块 psutil 1. 检测网段在线主机 import subprocessdef checkIP(ip):cmd fping -n 1 -w 1 {ip}null open(nlll,modewb)status subprocess.call(cmd,shellTrue,stdoutnull,stderrnull)if status 0:print(f"主机[{ip}]在…...

开源库存管理系统InvenTree的安装

本文是应网友 shijie880500 要求折腾的&#xff1b; 什么是 InvenTree &#xff1f; InvenTree 是一个开源的库存管理系统&#xff0c;提供强大的低级别库存控制和零件跟踪。InvenTree 系统的核心是 Python/Django 数据库后端&#xff0c;它提供了一个管理界面&#xff08;基于…...

[双指针] (二) LeetCode 202.快乐数 和 11.盛最多水的容器

[双指针] (二) LeetCode 202.快乐数 和 11.盛最多水的容器 快乐数 202. 快乐数 题目解析 (1) 判断一个数是不是快乐数 (2) 快乐数的定义&#xff1a;将整数替换为每个位上的和&#xff1b;如果最终结果为1&#xff0c;就是快乐数 (3) 这个数可能变为1&#xff0c;也可能无…...

前端、HTTP协议(重点)

什么是前端 前端是所有跟用户直接打交道的都可以称之为是前端 比如&#xff1a;PC页面、手机页面、平板页面、汽车显示屏、大屏幕展示出来的都是前端内容 能够用肉眼看到的都是前端 为什么要学前端 学了前端以后我们就可以做全栈工程师(会后端、会前端、会DB、会运维等) 咱…...

软件开发项目文档系列之六概要设计:构建可靠系统的蓝图

概要设计是软件开发项目中至关重要的阶段&#xff0c;它为整个系统提供了设计蓝图和技术方向。它的重要性在于明确项目目标、规划系统结构、确定技术选择、识别风险、以及为团队提供共同的视角&#xff0c;确保项目在后续开发阶段按计划进行。概要设计的主要内容包括项目的背景…...