第一种使用
把autoired标注在构造方法上,springboot将自动找到需要注入的bean
第二种使用
把autoired标注在变量上,springboot也同样会把bean注入到变量中;
注意 @Autoired是根据类型进行注入的;@Resource是根据方法名称进行注入的
第一种使用
把autoired标注在构造方法上,springboot将自动找到需要注入的bean
第二种使用
把autoired标注在变量上,springboot也同样会把bean注入到变量中;
注意 @Autoired是根据类型进行注入的;@Resource是根据方法名称进行注入的