【Spring Boot】详解条件注解以及条件拓展注解@Conditional与@ConditionalOnXxx

Spring

@Conditional

        Spring 4.0+提供的注解。作用是给需要装载的Bean增加一个条件判断。只有满足条件才会装在到IoC容器中。而这个条件可以由自己去完成的,可以通过重写Condition接口重写matches()方法去实现自定义的逻辑。所以说这个注解增加了对Bean装载的灵活性。

源码

        可以看出来首先可以修饰在类、接口、枚举以及方法上。并且可以接收一个或多个实现Condition接口的类。

        那么在Condition接口中只有一个返回布尔类型的matches()方法。从这个单词也看得出来这是匹配的意思,所以就是匹配校验Bean是否可以被加载进IoC容器中。Determine if the condition matches(确定条件是否匹配)。

实战代码

        以下先建两个Bean类、一个条件类、一个配置类、以及测试Main类。需要注意的是条件类中的参数并不是Spring的上下文ApplicationContext,所以其内容需要设置在-vm options中。至于这个-vm [options]中的options可以通过DOS窗口输入Java就可以看到有什么选项了。

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Animal {
	private String name;
	private String sex;
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Person {
	private String name;
	private Integer age;
}
public class PersonCondition implements Condition {

	/**
	 * @param context 上下文
	 * @param metadata 注解元信息
	 */
	@Override
	public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
		// 通过条件上下文获取环境中的配置文件信息
		String property = context.getEnvironment().getProperty("spring.createBean");
		if(null == property) {
			return false;
		}
		return property.contains("person");
	}
}
public class AnimalCondition implements Condition {

    /**
     * @param context 上下文
     * @param metadata 注解元信息
     */
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        // 通过条件上下文获取环境中的配置文件信息
        String property = context.getEnvironment().getProperty("spring.createBean");
        if(null == property) {
            return false;
        }
        return property.contains("animal");
    }
}

public class ConditionalTest {
    public static void main(String[] args) {
        // 通过Spring上下文ApplicationContext传入配置类获取其中的Bean描述并输出
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ConditionalConfig.class);
        Arrays.stream(applicationContext.getBeanDefinitionNames()).forEach(System.out::println);
    }
}

测试结果

SpringBoot

        关于@ConditionalOnXxx注解是在SpringBoot中拓展出来的,是原先Spring框架中没有存在的注解。那么以下就逐一去了解每个注解的作用。需要说的是这些注解全部都可以注解在类、接口、枚举和方法上

        从上图可以发现有十三种是@ConditionalOnXxx。其中就不了解@ConditionalOnCloudPlatform与@ConditionOnJndi这两个注解了。

       上面的扩展注解我们可以简单的分为以下几类:

  • Bean作为条件:@ConditionalOnBean、@ConditionalOnMissingBean、@ConditionalOnSingleCandidate。
  • 类作为条件:@ConditionalOnClass、@ConditionalOnMissingClass。
  • SpEL表达式作为条件:@ConditionalOnExpression。
  • Java版本作为条件: @ConditionalOnJava
  • 配置属性作为条件:@ConditionalOnProperty。
  • 资源文件作为条件:@ConditionalOnResource。
  • 是否Web应用作为判断条件:@ConditionalOnWebApplication、@ConditionalOnNotWebApplication。

条件为Bean的情况

@ConditionalOnBean

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional({OnBeanCondition.class})
public @interface ConditionalOnBean {

    /**
     * 需要作为条件的类的Class对象数组
     */
    Class<?>[] value() default {};

    /**
     * 需要作为条件的类的Name, Class.getName()
     */
    String[] type() default {};

    /**
     * (用于指定注解修饰的Bean)条件所需的注解类
     */
    Class<? extends Annotation>[] annotation() default {};

    /**
     * Spring容器中Bean的名字
     */
    String[] name() default {};

    /**
     * 搜索容器层级,当前容器,父容器
     */
    SearchStrategy search() default SearchStrategy.ALL;

    /**
     * 可能在其泛型参数中包含指定Bean类型的其他类
     */
    Class<?>[] parameterizedContainer() default {};
}

        源码中的属性就不一一展示测试了,这里就测试value于name即可,value传入的是Class类型。而这个注解的含义很简单:如果IoC容器中存在该注解中value属性对应的Bean,那么就加载被该注解注解的Bean。否则不加载。测试代码采用上面Spring目录下的测试结果中的代码。这里主要展示配置类中的逻辑。

@Configuration
public class ConditionalConfig {

	@Bean
	public Person person() {
		return new Person();
	}

	@Bean
	@ConditionalOnBean(Person.class)
    //@ConditionalOnBean(name = "com.gok.entity.Person")
	public Animal animal() {
		return new Animal();
	}
}

        这里需要注意的是,Spring加载Bean是在配置类中自上而下加载的,所以说如果person()与animal()两个方法换位置的话Animal是不会被加载到IoC容器中的,因为在它加载时Person还没被加载入IoC容器。

@ConditionalOnMissingBean

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(OnBeanCondition.class)
public @interface ConditionalOnMissingBean {

    /**
     * 需要作为条件的类的Class对象数组
     */
    Class<?>[] value() default {};

    /**
     * 需要作为条件的类的Name, Class.getName()
     */
    String[] type() default {};

    /**
     * 匹配Bean的时候需要忽视的Class对象数组,一般是父类
     * @ConditionalOnMissingBean(value = JdbcFactory.class, ignored = MySqlDefaultFactory.class)
     */
    Class<?>[] ignored() default {};

    /**
     * 匹配Bean的时候需要忽视的类的Name, Class.getName()
     */
    String[] ignoredType() default {};

    /**
     * (用于指定注解修饰的Bean)条件所需的注解类
     */
    Class<? extends Annotation>[] annotation() default {};

    /**
     * Spring容器中Bean的名字
     */
    String[] name() default {};

    /**
     * 搜索容器层级,当前容器,父容器
     */
    SearchStrategy search() default SearchStrategy.ALL;

    /**
     * 可能在其泛型参数中包含指定Bean类型的其他类
     */
    Class<?>[] parameterizedContainer() default {};
}

        理解了上面注解的作用,那这个注解就游刃有余了,miss单词意为错过、没有的意思。所以这个注解的作用就是:如果IoC容器中不存在该注解中value属性对应的Bean,那么就加载被该注解注解的Bean。否则不加载

@Configuration
public class ConditionalConfig {

	@Bean
	public Person person() {
		return new Person();
	}

	@Bean
	@ConditionalOnMissingBean(Person.class)
    //@ConditionalOnMissingBean(name = "com.gok.entity.Person")
	public Animal animal() {
		return new Animal();
	}
}

@ConditionalOnSingleCandidate

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(OnBeanCondition.class)
public @interface ConditionalOnSingleCandidate {

    /**
     * 需要作为条件的类的Class对象
     */
    Class<?> value() default Object.class;

    /**
     * 需要作为条件的类的Name, Class.getName()
     */
    String type() default "";

    /**
     * 搜索容器层级,当前容器,父容器
     */
    SearchStrategy search() default SearchStrategy.ALL;
}

        此注解从单词single与candidate可以得出是单个候选人的意思。大致可以猜测是存在相同类型的Bean的话只会对单个有效。我尝试将其放到person02()上,还是一样将这两个Bean加载到了IoC当中,但是放在第一个person01()上,导致person01没有被加载到IoC容器当中。所以此Bean的作用就是:如果当指定Bean在容器中只有一个,或者虽然有多个但是指定首选Bean的时候则生效。即同类型的Bean中,首选Bean无法被加载入IoC容器中。

@Configuration
public class ConditionalConfig {

	@Bean
	@ConditionalOnSingleCandidate
	public Person person01() {
		return new Person();
	}

	@Bean
	public Person person02() {
		return new Person();
	}
}

条件为类的情况

@ConditionalOnClass

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(OnClassCondition.class)
public @interface ConditionalOnClass {

    /**
     * 需要作为条件的类的Class对象数组
     */
    Class<?>[] value() default {};

    /**
     * 需要作为条件的类的Name, Class.getName()
     */
    String[] name() default {};
}

        这个其实和@ConditionalOnBean类似,但是那个注解是在IoC容器中或者是类全限定名找是否存在该Spring Bean。而@ConditionalOnClas是在IoC容器中或者是类全限定名找到是否存在该类。如果存在就加载,不存在就不加载到IoC容器中。

@ConditionalMissingClass

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional({OnClassCondition.class})
public @interface ConditionalOnMissingClass {

    /**
     * 需要作为条件的类的Name, Class.getName()
     */
    String[] value() default {};
}

        与@ConditionalOnClass相反。会在这里一起展示代码以及测试的结果。Plant类是真实存在的,所以说person01被加载到IoC容器中,而person02没有被加载到IoC当中。

@Configuration
public class ConditionalConfig {

	@Bean
	@ConditionalOnClass(Animal.class)
	public Person person01() {
		return new Person();
	}

	@Bean
	@ConditionalOnMissingClass("com.gok.entity.Animal")
	public Person person02() {
		return new Person();
	}
}

条件为SpEL表达式的情况

@ConditionalOnExpression

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
@Documented
@Conditional(OnExpressionCondition.class)
public @interface ConditionalOnExpression {

    /**
     * 要作为条件的SpEL表达式
     */
    String value() default "true";
}

        这个注解就是用来判断该Bean是否符合SpEL表达式,至于什么是SpEL表达式就自行百度学习了,就不多放篇幅去详细说明了。这里我设置person01为true,而person02为false。

@Configuration
public class ConditionalConfig {

	@Bean
	@ConditionalOnExpression("true")
	public Person person01() {
		return new Person();
	}

	@Bean
	@ConditionalOnExpression("false")
	public Person person02() {
		return new Person();
	}
}

条件为Java的情况

@ConditionalOnJava

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(OnJavaCondition.class)
public @interface ConditionalOnJava {

    /**
     * 比较方式,Range.EQUAL_OR_NEWER:当前版本等于或高于、Range.OLDER_THAN:当前版本老于,越早的版本越老
     */
    ConditionalOnJava.Range range() default ConditionalOnJava.Range.EQUAL_OR_NEWER;

    /**
     * 指定JAVA版本
     */
    JavaVersion value();

    /**
     * Range options.
     */
    public static enum Range {

        /**
         * Equal to, or newer than the specified {@link JavaVersion}.
         */
        EQUAL_OR_NEWER,

        /**
         * Older than the specified {@link JavaVersion}.
         */
        OLDER_THAN

        private Range() {}
    }
}

         此注解用来判断当前运行环境的Java版本是多少。符合范围内的条件才会加载Bean。

@Configuration
public class ConditionalConfig {

	@Bean
	@ConditionalOnJava(JavaVersion.EIGHT)
	public Person person01() {
		return new Person();
	}

	@Bean
	@ConditionalOnJava(JavaVersion.NINE)
	public Person person02() {
		return new Person();
	}
}

条件为配置条件的情况

@ConditionalOnProperty

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
@Documented
@Conditional(OnPropertyCondition.class)
public @interface ConditionalOnProperty {

    /**
     * 对应property名称的值
     */
    String[] value() default {};
    String[] name() default {};

    /**
     * property名称的前缀,可有可无
     */
    String prefix() default "";

    /**
     * 与name组合使用,比较获取到的属性值与havingValue给定的值是否相同,相同才加载配置
     */
    String havingValue() default "";

    /**
     * 缺少该property时是否可以加载。如果为true,没有该property也会正常加载;反之报错
     */
    boolean matchIfMissing() default false;
}

        此注解用于条件配置中读取peoperties文件中的信息。本人测试读取yml无效,需要在配置类上多添加个@PropertySource注解读取文件才能够使用配置条件注解。

# application.properties中的内容
com.gok.test=true
com.gok.password=123456
@Configuration
// 读取properties文件的方式 可以配合@Value注解读取详细信息
@PropertySource(value = "classpath:application.properties", encoding = "UTF-8")
//@PropertySources({@PropertySource(value = "classpath:application.properties", encoding = "UTF-8")})
public class ConditionalConfig {

	@Bean
	@ConditionalOnProperty("com.gok.test")
	public Person person01() {
		return new Person();
	}

	@Bean
	@ConditionalOnProperty(name = "com.gok.test")
	public Person person02() {
		return new Person();
	}

	@Bean
	@ConditionalOnProperty("com.gok.password")
	public Person person03() {
		return new Person();
	}

	@Bean
	@ConditionalOnProperty(name = "com.gok.password", havingValue = "123456")
	public Person person04() {
		return new Person();
	}

	@Bean
	@ConditionalOnProperty(name = "com.gok.password", havingValue = "123456789")
	public Person person05() {
		return new Person();
	}

	@Bean
	@ConditionalOnProperty(value = "com.gok.password=123456", matchIfMissing = true)
	public Person person06() {
		return new Person();
	}

	@Bean
	// 这里要注意如果要使用prefix前缀的话 必须带上name或者value
	// 或者会报错:The name or value attribute of @ConditionalOnProperty must be specified
	// 以下拼接即为:是否存在com.gok.password这个属性
	@ConditionalOnProperty(prefix = "com.gok", name = "password")
	public Person person07() {
		return new Person();
	}
}

条件为资源条件的情况

@ConditionalOnResource

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(OnResourceCondition.class)
public @interface ConditionalOnResource {

    /**
     * 要作为判断条件的资源文件名称  @ConditionalOnResource(resources = ”mybatis.xml”)
     */
    String[] resources() default {};
}

        查询指定的资源,不仅仅可以查找classpath下的文件,还可以用来查找外部资源是否存在。

@Configuration
public class ConditionalConfig {

	@Bean
	@ConditionalOnResource(resources = "https://www.baidu.com")
	public Person person01() {
		return new Person();
	}

	@Bean
	@ConditionalOnResource(resources = "classpath:application.properties")
	public Person person02() {
		return new Person();
	}

	@Bean
	@ConditionalOnResource(resources = "https://www.baiduhaha.com")
	public Person person03() {
		return new Person();
	}
}

条件为Web应用的情况

@ConditionalOnWebApplication

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(OnWebApplicationCondition.class)
public @interface ConditionalOnWebApplication {

    /**
     * 需要作为条件的Web应用程序的必需类型
     */
    ConditionalOnWebApplication.Type type() default ConditionalOnWebApplication.Type.ANY;

    /**
     * Available application types.
     */
    public static enum Type {

        /**
         * 任何web应用都将匹配
         */
        ANY,

        /**
         * 仅基于servlet的Web应用程序将匹配
         */
        SERVLET,

        /**
         * 仅基于反应式的Web应用程序将匹配
         */
        REACTIVE;

        private Type() {}
    }
}

        判断当前是否为Web项目/Web环境。主要就是从是否有导入Web的依赖。这里简单介绍以下三种不同情况的依赖引入情况。

<!-- 无Web容器 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- 使用Tomcat/Servlet Web容器 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 使用Netty 响应式的Web容器 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-webflux</artifactId>
</dependency>

@ConditionalOnNotWebApplication

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional({OnWebApplicationCondition.class})
public @interface ConditionalOnNotWebApplication {
}

参考文章

https://www.cnblogs.com/dusucyy/p/16609736.html

@ConditionalOnBean详解_你就像甜甜的益达的博客-CSDN博客a

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【肌电图信号分析】通道肌电图并查找收缩周期的数量、振幅、最大值和持续时间(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

在本地搭建Jellyfin影音服务器,支持公网远程访问影音库的方法分享

文章目录 1. 前言2. Jellyfin服务网站搭建2.1. Jellyfin下载和安装2.2. Jellyfin网页测试 3.本地网页发布3.1 cpolar的安装和注册3.2 Cpolar云端设置3.3 Cpolar本地设置 4.公网访问测试5. 结语 1. 前言 随着移动智能设备的普及&#xff0c;各种各样的使用需求也被开发出来&…

threejs贴图系列(一)canvas贴图

threejs不仅支持各种texture的导入生成贴图&#xff0c;还可以利用canvas绘制图片作为贴图。这就用到了CanvasTexture&#xff0c;它接受一个canas对象。只要我们绘制好canvas&#xff0c;就可以作为贴图了。这里我们利用一张图片来实现这个效果。 基础代码&#xff1a; impo…

sizeof和strlen的对比

文章目录 &#x1f6a9;前言&#x1f6a9;sizeof&#x1f6a9;strlen&#x1f6a9;sizeof和strlen对比 &#x1f6a9;前言 很多小白在学习中&#xff0c;经常将sizeof和strlen弄混了。本篇文章&#xff0c;小编讲解一下sizeof和strlen的区别。&#x1f937;‍♂️ &#x1f6a9…

分享好用的翻译软件

网易有道翻译→网易有道翻译

npm install 安装依赖,报错 Host key verification failed

设置 git 的身份和邮箱 git config --global user.name "你的名字" > 用户名 git config --global user.email “你的邮箱" > 邮箱进入 > 用户 > [你的用户名] > .ssh文件夹下,删除 known_hosts 文件即可 进入之后有可能会看到 known_hosts…

css实现文字的渐变,适合大屏

1 在全局写一个全局样式&#xff0c;文字渐变 2 在组件中使用 CSS3利用-webkit-background-clip: text;实现文字渐变效果_css如何把盒子底部的文字变成透明渐变_I俩月亮的博客-CSDN博客 CSS 如何实现文字渐变色 &#xff1f;_css字体颜色渐变_一个水瓶座程序猿.的博客-CSDN博客…

docker 安装 redis

目录 1、下载镜像文件 2、创建实例并启动 3、使用 redis 镜像执行 redis-cli 命令连接 4、redis持久化操作 5、然后按照第3点&#xff0c;再试一试&#xff0c;看看redis持久化是否配置成功。 6、最后与redis可视化工具测试连接 大家先 su root&#xff0c;这让输入命令就…

goland 中的调试器 -- Evaluate

今天一个好朋友 找到我&#xff0c;问我关于goland中Evaluate 小计算器的使用方式&#xff0c;说实话&#xff0c;我在此之前也没用过这个东西&#xff0c;然后我就找一些相关文档&#xff0c;但是这类文档少的可怜&#xff0c;所以我就稍微研究一下&#xff0c;找找材料&#…

【QT5-自我学习-线程qThread移植与使用-通过代码完成自己需要功能-移植小记3】

【QT5-自我学习-线程qThread移植与使用-通过代码完成自己需要功能-移植小记3】 1、前言2、实验环境3、自我总结&#xff08;1&#xff09;文件的编写&#xff08;2&#xff09;信号与槽的新理解&#xff08;3&#xff09;线程数据的传递 4、移植步骤第一步&#xff1a;添加新文…

华为云Stack的学习(一)

一、华为云Stack架构 1.HCS 物理分散、逻辑统一、业务驱动、运管协同、业务感知 2.华为云Stack的特点 可靠性 包括整体可靠性、数据可靠性和单一设备可靠性。通过云平台的分布式架构&#xff0c;从整体系统上提高可靠性&#xff0c;降低系统对单设备可靠性的要求。 可用性…

2023年国赛 高教社杯数学建模思路 - 案例:退火算法

文章目录 1 退火算法原理1.1 物理背景1.2 背后的数学模型 2 退火算法实现2.1 算法流程2.2算法实现 建模资料 ## 0 赛题思路 &#xff08;赛题出来以后第一时间在CSDN分享&#xff09; https://blog.csdn.net/dc_sinor?typeblog 1 退火算法原理 1.1 物理背景 在热力学上&a…

Windows10批处理命令行设置环境变量笔记,无需重新安装python与chrome

近期&#xff0c;工作中经常安装、部署python生产、开发环境&#xff0c;比较麻烦&#xff0c;也没有心情去优化。突然&#xff0c;我的电脑崩溃了&#xff0c;在重新安装电脑的过程中&#xff0c;保留了原来的安装软件&#xff08;有的没有放在系统盘中&#xff09;&#xff0…

【生态经济学】利用R语言进行经济学研究技术——从数据的收集与清洗、综合建模评价、数据的分析与可视化、因果推断等方面入手

查看原文>>>如何快速掌握利用R语言进行经济学研究技术——从数据的收集与清洗、综合建模评价、数据的分析与可视化、因果推断等方面入手 近年来&#xff0c;人工智能领域已经取得突破性进展&#xff0c;对经济社会各个领域都产生了重大影响&#xff0c;结合了统计学、…

vue 简单实验 自定义组件 component

1.代码 <script src"https://unpkg.com/vuenext" rel"external nofollow" ></script> <div id"components-demo"><button-counter></button-counter> </div> <script> // 创建一个Vue 应用 const ap…

6种方法Word中的页眉横线如何删除

01 如何给Word添加页眉&#xff1f; 方法1&#xff1a; 打开Word文档&#xff0c;将鼠标放在Word顶部&#xff0c;双击鼠标&#xff0c;就可以进入页眉编辑状态&#xff0c;这时候&#xff0c;直接添加页眉内容就好了。 方法2&#xff1a; 在Word文档顶部菜单栏点击【插入】…

【数据结构】C语言实现栈(详细解读)

前言: &#x1f4a5;&#x1f388;个人主页:​​​​​​Dream_Chaser&#xff5e; &#x1f388;&#x1f4a5; ✨✨专栏:http://t.csdn.cn/oXkBa ⛳⛳本篇内容:c语言数据结构--C语言实现栈 目录 什么是栈 栈的概念及结构 实现栈的方式 链表的优缺点: 顺序表的优缺点: 栈…

高性能网络模式-Reactor

事实上&#xff0c;Reactor 模式也叫Dispatcher模式&#xff0c;即I/O 多路复⽤监听事件&#xff0c;收到事件后&#xff0c;根据事件类型分配&#xff08;Dispatch&#xff09;给某个进程/线程。Reactor 模式也是一种非阻塞同步网络模式。 Reactor 模式主要由 Reactor部分和处…

platform相关资料

Step 1: Hardware Settings for Vitis Platform — Vitis™ Tutorials 2021.2 documentationhttps://xilinx.github.io/Vitis-Tutorials/2021-2/build/html/docs/Vitis_Platform_Creation/Introduction/03_Edge_VCK190/step1.html https://www.cnblogs.com/VagueCheung/p/1313…

Jmeter 快速生成测试报告

我们使用Jmeter工具进行接口测试或性能测试后一般是通过察看结果数、聚合报告等监听器来查看响应结果。如果要跟领导汇报测试结果&#xff0c;无法直接通过监听器的结果来进行展示和汇报&#xff0c;因为太low了&#xff0c;因此测试完成后去整理一个数据齐全且美观的报告是非常…
最新文章