如题,不知道这个注解里的参数是干什么用的
public @interface Async {
/**
* A qualifier value for the specified asynchronous operation(s).
* <p>May be used to determine the target executor to be used when executing this
* method, matching the qualifier value (or the bean name) of a specific
* {@link java.util.concurrent.Executor Executor} or
* {@link org.springframework.core.task.TaskExecutor TaskExecutor}
* bean definition.
* <p>When specified on a class level {@code @Async} annotation, indicates that the
* given executor should be used for all methods within the class. Method level use
* of {@code Async#value} always overrides any value set at the class level.
* @since 3.1.2
*/
String value() default "";
}
用于指定使用哪一个线程池执行
642/5000
/ * *
*指定异步操作的限定符值。
*
可用于确定执行此操作时要使用的目标执行程序
方法,匹配特定的限定符值(或bean名称)
{ @link java . util . concurrent。遗嘱执行人执行人}或
{ @link org.springframework.core.task。TaskExecutor TaskExecutor }
bean定义。
*
当在类级别{@code @Async}注释中指定时,表示
*给定的executor应该用于类中的所有方法。方法级使用
*的{@code async#值}总是覆盖在类级别上设置的任何值。
@since 3.1.2
/
这个注解用于异步执行一个方法,就是在主线程之外开辟一个线程来执行这个方法。
例如在一个方法上加上@Async注解,则在另一个方法中调用这个方法时不会阻塞当前的方法,两个方法可以同步执行,
具体的例子可以参考 https://blog.csdn.net/qq_16055765/article/details/79025485
异步执行,主线程继续执行下面步骤。