spring mvc源码学习笔记之八

本文说点儿简单的。
如果你想研究基于 XML 配置的 spring mvc 的话,可以简单扫一眼本文。

在基于 XML 配置的 spring mvc 开发中,我们主要就是通过 spring 提供的各种标签来配置。
但是,大家是不是都有个疑问,spring 到底给我们提供了多少标签?都有哪些?子元素有哪些?属性有哪些?

当然,如果你对 XML 非常熟悉,那简单,直接看对应模块的 schema 文件就行了。
比如在 sping-webmvc 模块的 META-INF/spring.schemas 文件中就定义了如下这些 schema

http\://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd=org/springframework/web/servlet/config/spring-mvc.xsd
http\://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd=org/springframework/web/servlet/config/spring-mvc.xsd
http\://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd=org/springframework/web/servlet/config/spring-mvc.xsd
http\://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd=org/springframework/web/servlet/config/spring-mvc.xsd
http\://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd=org/springframework/web/servlet/config/spring-mvc.xsd
http\://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd=org/springframework/web/servlet/config/spring-mvc.xsd
http\://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd=org/springframework/web/servlet/config/spring-mvc.xsd
http\://www.springframework.org/schema/mvc/spring-mvc.xsd=org/springframework/web/servlet/config/spring-mvc.xsd

你点开这些链接,研究其中的内容就行了,比如 http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd 这个文件内容如下(只是部分)

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<xsd:schema xmlns="http://www.springframework.org/schema/mvc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:tool="http://www.springframework.org/schema/tool" targetNamespace="http://www.springframework.org/schema/mvc" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="https://www.springframework.org/schema/beans/spring-beans-4.3.xsd"/>
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="https://www.springframework.org/schema/tool/spring-tool-4.3.xsd"/>
<xsd:element name="annotation-driven">
<xsd:annotation>
<xsd:documentation source="java:org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<![CDATA[ Configures the annotation-driven Spring MVC Controller programming model. Note that this tag works in Web MVC only, not in Portlet MVC! See org.springframework.web.servlet.config.annotation.EnableWebMvc javadoc for details on code-based alternatives to enabling annotation-driven Spring MVC support. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all minOccurs="0">
<xsd:element name="path-matching" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Configures the path matching part of the Spring MVC Controller programming model. Like annotation-driven, code-based alternatives are also documented in EnableWebMvc javadoc. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="suffix-pattern" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Whether to use suffix pattern match (".*") when matching patterns to requests. If enabled a method mapped to "/users" also matches to "/users.*". The default value is true. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="trailing-slash" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Whether to match to URLs irrespective of the presence of a trailing slash. If enabled a method mapped to "/users" also matches to "/users/". The default value is true. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="registered-suffixes-only" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Whether suffix pattern matching should work only against path extensions explicitly registered when you configure content negotiation. This is generally recommended to reduce ambiguity and to avoid issues such as when a "." appears in the path for other reasons. The default value is false. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="path-helper" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The bean name of the UrlPathHelper to use for resolution of lookup paths. Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple HandlerMappings and MethodNameResolvers. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="path-matcher" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The bean name of the PathMatcher implementation to use for matching URL paths against registered URL patterns. Default is AntPathMatcher. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="message-converters" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Configures one or more HttpMessageConverter types to use for converting @RequestBody method parameters and @ResponseBody method return values. Using this configuration element is optional. HttpMessageConverter registrations provided here will take precedence over HttpMessageConverter types registered by default. Also see the register-defaults attribute if you want to turn off default registrations entirely. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:choice maxOccurs="unbounded">
<xsd:element ref="beans:bean">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ An HttpMessageConverter bean definition. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element ref="beans:ref">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ A reference to an HttpMessageConverter bean. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="register-defaults" type="xsd:boolean" default="true">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Whether or not default HttpMessageConverter registrations should be added in addition to the ones provided within this element. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="argument-resolvers" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Configures HandlerMethodArgumentResolver types to support custom controller method argument types. Using this option does not override the built-in support for resolving handler method arguments. To customize the built-in support for argument resolution configure RequestMappingHandlerAdapter directly. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element ref="beans:bean" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The HandlerMethodArgumentResolver (or WebArgumentResolver for backwards compatibility) bean definition. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element ref="beans:ref" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ A reference to a HandlerMethodArgumentResolver bean definition. ]]>
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="java:org.springframework.web.method.support.HandlerMethodArgumentResolver"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="return-value-handlers" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Configures HandlerMethodReturnValueHandler types to support custom controller method return value handling. Using this option does not override the built-in support for handling return values. To customize the built-in support for handling return values configure RequestMappingHandlerAdapter directly. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element ref="beans:bean" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The HandlerMethodReturnValueHandler bean definition. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element ref="beans:ref" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ A reference to a HandlerMethodReturnValueHandler bean definition. ]]>
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="java:org.springframework.web.method.support.HandlerMethodReturnValueHandler"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="async-support" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Configure options for asynchronous request processing. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:all minOccurs="0">
<xsd:element name="callable-interceptors" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The ordered set of interceptors that intercept the lifecycle of concurrently executed requests, which start after a controller returns a java.util.concurrent.Callable. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="beans:bean" minOccurs="1" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Registers a CallableProcessingInterceptor. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="deferred-result-interceptors" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The ordered set of interceptors that intercept the lifecycle of concurrently executed requests, which start after a controller returns a DeferredResult. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="beans:bean" minOccurs="1" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Registers a DeferredResultProcessingInterceptor. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
<xsd:attribute name="task-executor" type="xsd:string">
<xsd:annotation>
<xsd:documentation source="java:org.springframework.core.task.AsyncTaskExecutor">
<![CDATA[ The bean name of a default AsyncTaskExecutor to use when a controller method returns a {@link Callable}. Controller methods can override this default on a per-request basis by returning an AsyncTask. By default, a SimpleAsyncTaskExecutor is used which does not re-use threads and is not recommended for production. ]]>
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="java:org.springframework.core.task.AsyncTaskExecutor"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="default-timeout" type="xsd:long">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Specify the amount of time, in milliseconds, before asynchronous request handling times out. In Servlet 3, the timeout begins after the main request processing thread has exited and ends when the request is dispatched again for further processing of the concurrently produced result. If this value is not set, the default timeout of the underlying implementation is used, e.g. 10 seconds on Tomcat with Servlet 3. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:all>
<xsd:attribute name="conversion-service" type="xsd:string">
<xsd:annotation>
<xsd:element ref="beans:ref">
<xsd:annotation>
<xsd:documentation source="org.springframework.web.servlet.resource.ResourceResolver">
<![CDATA[ A reference to a ResourceResolver bean. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="resource-transformers">
<xsd:annotation>
<xsd:documentation source="org.springframework.web.servlet.resource.ResourceTransformer">
<![CDATA[ A list of ResourceTransformer beans definition and references. A ResourceTransformer provides mechanisms for transforming the content of a resource. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:choice maxOccurs="unbounded">
<xsd:element ref="beans:bean">
<xsd:annotation>
<xsd:documentation source="org.springframework.web.servlet.resource.ResourceTransformer">
<![CDATA[ A ResourceTransformer bean definition. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element ref="beans:ref">
<xsd:annotation>
<xsd:documentation source="org.springframework.web.servlet.resource.ResourceTransformer">
<![CDATA[ A reference to a ResourceTransformer bean. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="resource-chain">
<xsd:annotation>
</xsd:attribute>
<xsd:attribute name="content-type" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Set the content type to use for the response (text/html by default). ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="charset" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Set the charset used to read script and template files (UTF-8 by default). ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="resource-loader-path" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The script engine resource loader path via a Spring resource location. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="shared-engine" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ When set to false, use thread-local ScriptEngine instances instead of one single shared instance. This flag should be set to false for those using non thread-safe script engines with templating libraries not designed for concurrency, like Handlebars or React running on Nashorn for example. In this case, Java 8u60 or greater is required due to this bug: https://bugs.openjdk.java.net/browse/JDK-8076099. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="cors">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Configure cross origin requests processing. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="mapping" minOccurs="1" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Enable cross origin requests processing on the specified path pattern. By default, all origins, GET HEAD POST methods, all headers and credentials are allowed and max age is set to 30 minutes. ]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="path" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ A path into the application that should handle CORS requests. Exact path mapping URIs (such as "/admin") are supported as well as Ant-stype path patterns (such as /admin/**). ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="allowed-origins" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Comma-separated list of origins to allow, e.g. "https://domain1.com, https://domain2.com". The special value "*" allows all domains (default). Note that CORS checks use values from "Forwarded" (RFC 7239), "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" headers, if present, in order to reflect the client-originated address. Consider using the ForwardedHeaderFilter in order to choose from a central place whether to extract and use such headers, or whether to discard them. See the Spring Framework reference for more on this filter. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="allowed-methods" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Comma-separated list of HTTP methods to allow, e.g. "GET, POST". The special value "*" allows all method. By default GET, HEAD and POST methods are allowed. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="allowed-headers" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Comma-separated list of headers that a pre-flight request can list as allowed for use during an actual request. The special value of "*" allows actual requests to send any header (default). ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="exposed-headers" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Comma-separated list of response headers other than simple headers (i.e. Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, Pragma) that an actual response might have and can be exposed. Empty by default. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="allow-credentials" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Whether user credentials are supported (true by default). ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="max-age" type="xsd:long">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ How long, in seconds, the response from a pre-flight request can be cached by clients. 1800 seconds (30 minutes) by default. ]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

从这个角度入手,是没问题的。但是我感觉大多数人看了这种都头疼(除非你精通 XML)。

接下来,可以看另外一个文件 META-INF/spring.handlers 。比如,spring-webmvc 模块中,这个文件内容如下

http\://www.springframework.org/schema/mvc=org.springframework.web.servlet.config.MvcNamespaceHandler

MvcNamespaceHandler 这个类的内容如下

/** Copyright 2002-2016 the original author or authors.** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package org.springframework.web.servlet.config;import org.springframework.beans.factory.xml.NamespaceHandler;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;/*** {@link NamespaceHandler} for Spring MVC configuration namespace.** @author Keith Donald* @author Jeremy Grelle* @author Sebastien Deleuze* @since 3.0*/
public class MvcNamespaceHandler extends NamespaceHandlerSupport {@Overridepublic void init() {registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenBeanDefinitionParser());registerBeanDefinitionParser("default-servlet-handler", new DefaultServletHandlerBeanDefinitionParser());registerBeanDefinitionParser("interceptors", new InterceptorsBeanDefinitionParser());registerBeanDefinitionParser("resources", new ResourcesBeanDefinitionParser());registerBeanDefinitionParser("view-controller", new ViewControllerBeanDefinitionParser());registerBeanDefinitionParser("redirect-view-controller", new ViewControllerBeanDefinitionParser());registerBeanDefinitionParser("status-controller", new ViewControllerBeanDefinitionParser());registerBeanDefinitionParser("view-resolvers", new ViewResolversBeanDefinitionParser());registerBeanDefinitionParser("tiles-configurer", new TilesConfigurerBeanDefinitionParser());registerBeanDefinitionParser("freemarker-configurer", new FreeMarkerConfigurerBeanDefinitionParser());registerBeanDefinitionParser("groovy-configurer", new GroovyMarkupConfigurerBeanDefinitionParser());registerBeanDefinitionParser("script-template-configurer", new ScriptTemplateConfigurerBeanDefinitionParser());registerBeanDefinitionParser("cors", new CorsBeanDefinitionParser());}}

看到这是不是就清晰了。

<mvc:annotation-driven/> 这个标签就是被类 AnnotationDrivenBeanDefinitionParser 解析的。以此类推。其他标签也是由对应的类解析的。

这里是以 spring-webmvc 模块为例来说的,其他模块如 spring-beans 、spring-context 都有对应 META-INF/spring.handlers 文件。分别用于解析对应的命名空间下的标签。
解释下命名空间的意思,就拿 <mvc:annotation-driven/> 来说,mvc 就是命名空间,再比如 <context:component-scan/> 这个标签,context 就是命名空间。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/505643.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

使用docker-compose安装Redis的主从+哨兵模式

必看 本文是一主二从一哨兵模式&#xff1b;其余的单机/集群/多哨兵模式的话&#xff0c;不在本文... 本文的环境主要是&#xff1a;应用app在本地&#xff0c;redis在云服务器上&#xff1b; 图解 图如下&#xff1a;这个图很重要&#xff1b; 之所以要这样画图&#xff0…

电脑提示directx错误导致玩不了游戏怎么办?dx出错的解决方法

想必大家都有过这样的崩溃瞬间&#xff1a;满心欢喜打开心仪的游戏&#xff0c;准备在虚拟世界里大杀四方或者畅游冒险&#xff0c;结果屏幕上突然弹出个 DirectX 错误的提示框&#xff0c;紧接着游戏闪退&#xff0c;一切美好戛然而止。DirectX 作为 Windows 系统下游戏运行的…

汽车基础软件AutoSAR自学攻略(三)-AutoSAR CP分层架构(2)

汽车基础软件AutoSAR自学攻略(三)-AutoSAR CP分层架构(2) 下面我们继续来介绍AutoSAR CP分层架构&#xff0c;下面的文字和图来自AutoSAR官网目前最新的标准R24-11的分层架构手册。该手册详细讲解了AutoSAR分层架构的设计&#xff0c;下面让我们来一起学习一下。 Introductio…

消息中间件类型介绍

消息中间件是一种在分布式系统中用于实现消息传递的软件架构模式。它能够在不同的系统或应用之间异步地传输数据&#xff0c;实现系统的解耦、提高系统的可扩展性和可靠性。以下是几种常见的消息中间件类型及其介绍&#xff1a; 1.RabbitMQ 特点&#xff1a; • 基于AMQP&#…

WEB攻防-通用漏洞_文件上传_黑白盒审计流程

目录 前置知识点 Finecms-CMS文件上传 ​编辑 Cuppa-Cms文件上传 Metinfo-CMS 文件上传 前置知识点 思路&#xff1a; 黑盒就是寻找一切存在文件上传的功能应用 1 、个人用户中心是否存在文件上传功能 2 、后台管理系统是否存在文件上传功能 3 、字典目录扫描探针文件上传构…

“深入浅出”系列之FFmpeg:(1)音视频开发基础

我的音视频开发大部分内容是跟着雷霄骅大佬学习的&#xff0c;所以笔记也是跟雷老师的博客写的。 一、音视频相关的基础知识 首先播放一个视频文件的流程如下所示&#xff1a; FFmpeg的作用就是将H.264格式的数据转换成YUV格式的数据&#xff0c;然后SDL将YUV显示到电脑屏幕上…

搭建docker私有化仓库Harbor

Docker私有仓库概述 Docker私有仓库介绍 Docker私有仓库是个人、组织或企业内部用于存储和管理Docker镜像的存储库。Docker默认会有一个公共的仓库Docker Hub,而与Docker Hub不同,私有仓库是受限访问的,只有授权用户才能够上传、下载和管理其中的镜像。这种私有仓库可以部…

fast-crud select下拉框 实现多选功能及下拉框数据动态获取(通过接口获取)

教程 fast-crud select示例配置需求:需求比较复杂 1. 下拉框选项需要通过后端接口获取 2. 实现多选功能 由于这个前端框架使用逻辑比较复杂我也是第一次使用,所以只记录核心问题 环境:vue3,typescript,fast-crud ,elementPlus 效果 代码 // crud.tsx文件(/.ts也行 js应…

在Windows环境下搭建无人机模拟器

最近要开发无人机地面站&#xff0c;但是没有无人机&#xff0c;开发无人机对我来说也是大姑娘坐花轿——头一回。我们要用 MAVLink 和无人机之间通信&#xff0c;看了几天 MAVLink&#xff0c;还是不得劲儿&#xff0c;没有实物实在是不好弄&#xff0c;所以想先装一个无人机模…

HTB:Topology[WriteUP]

目录 连接至HTB服务器并启动靶机 信息收集 使用rustscan对靶机TCP端口进行开放扫描 提取并保存靶机TCP开放端口号 使用nmap对靶机TCP开放端口进行脚本、服务扫描 使用nmap对靶机TCP开放端口进行漏洞、系统扫描 使用nmap对靶机常用UDP端口进行开放扫描 使用浏览器访问靶…

【 Verdi实用技巧-Part-3】

Verdi实用技巧-Part-3 3 Verdi实用技巧-Part-33.1 nWave window(看波形窗口)3.2 收集coverage3.3 nWave window3.4 Verdi-->app3.5 Force信号用Verdi去debug 本篇文章继续介绍Verdi实用技巧–Part-3; 3 Verdi实用技巧-Part-3 3.1 nWave window(看波形窗口) nWave window …

Vue sm3国密 IE模式报错处理

1、sm-crypto 转义错误 查看报错信息包名 在vue.config.js的transpileDependencies中把依赖包添加进去&#xff0c;让babel能够转译sm-crypto包 babel.config.js module.exports {presets: [[vue/app, {useBuiltIns: entry}]] }2、exports.destroy (() &#xff1e; { … }&a…

docker 基本使用

-do1.安装docker: Redirecting… 0. docker内使用gpu, 安装nvidia-docker: https://github.com/NVIDIA/nvidia-docker, 安装后使用&#xff1a;nvidia-container-cli -k -d /dev/tty list&#xff0c; 验证正确&#xff0c;无报错&#xff0c;即为正确 1. docker 启动image,如…

手机的ip地址是根据电话卡归属地定吗

在智能手机普及的今天&#xff0c;IP地址作为我们连接互联网的“门牌号”&#xff0c;其来源和确定方式常常引发用户的好奇。特别是关于手机IP地址是否与电话卡的归属地直接相关&#xff0c;这一话题更是众说纷纭。本文将深入探讨这一问题&#xff0c;为您揭开手机IP地址与电话…

计算机网络 (32)用户数据报协议UDP

前言 用户数据报协议&#xff08;UDP&#xff0c;User Datagram Protocol&#xff09;是计算机网络中的一种重要传输层协议&#xff0c;它提供了无连接的、不可靠的、面向报文的通信服务。 一、基本概念 UDP协议位于传输层&#xff0c;介于应用层和网络层之间。它不像TCP那样提…

YOLOv5改进 | CARAFE提高精度的上采样方法

目录 1 CARAFE模块原理 1.1 上采样的表示 1.2 Motivation 2 YOLOv5中加入CARAFE模块 2.1 ultralytics/nn/modules/block.py文件配置 2.2 ultralytics/nn/tasks.py配置 2.3 创建添加优化点模块的yolov5x-CARAFE.yaml 参考文献 1 CARAFE模块原理 上采样操作可以表示为…

高通,联发科(MTK)等手机平台调优汇总

一、常见手机型号介绍&#xff1a; ISP除了用在安防行业&#xff0c;还有手机市场&#xff0c;以及目前新型的A/VR眼睛&#xff0c;机器3D视觉机器人&#xff0c;医疗内窥镜这些行业。 下面是一些最近几年发布的,,,旗舰SOC型号&#xff1a; 1.联发科&#xff1a;天玑92…

windows从0开始配置llamafactory微调chatglm3-6b

后续会更新 从0学习LLaMaFactory参数解释说明 &#xff0c;请期待~ 文章目录 一、准备工作1、创建python虚拟环境(annoconda)2、配置pytorch傻瓜版3、llamafactory配置4、微调数据准备5、开始微调5.1 webui启动微调5.2 指令启动微调 一、准备工作 1、创建python虚拟环境(annoc…

某漫画网站JS逆向反混淆流程分析

文章目录 1. 写在前面1. 接口分析2. 反混淆分析 【&#x1f3e0;作者主页】&#xff1a;吴秋霖 【&#x1f4bc;作者介绍】&#xff1a;擅长爬虫与JS加密逆向分析&#xff01;Python领域优质创作者、CSDN博客专家、阿里云博客专家、华为云享专家。一路走来长期坚守并致力于Pyth…

netplan apply报错No module named ‘netifaces‘

Ubuntu 20.04.5 LTS \n \l&#xff0c;ctrlaltf2切换字符登录f1切换图形 处理办法&#xff1a; root登录执行 rootnode37:/disk1/Qwen2.5-72B-Instruct-GPTQ-Int4# cat /etc/netplan/01-network-manager-all.yaml # Let NetworkManager manage all devices on this system …