springboot 属性注入(@Autowired、@Resource)
********************
相关注解
@Autowired:spring提供注解,根据类型注入属性
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Autowired {
/**
* Declares whether the annotated dependency is required.
* <p>Defaults to {@code true}.
*/
boolean required() default true;
}
@Qualifier:@Autowired注入时,若有多个同类型的bean,可使用该注解