1.美圖
2.概述
@Lazy
:用於標識Bean
是否需要延遲加載,延時加載就是在第一次使用的時候才加載。@Lazy
的主要作用就是用來減少Spring IOC
容器啓動的加載時間。
3.源碼
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Lazy {
/**
* 是否懶加載
*/
boolean value() default true;
}