1)@Bean

将类交给spring容器的3种办法

 将类交给spring容器的3种办法

 

 2)@Component

将类交给spring容器的3种办法

 

 将类交给spring容器的3种办法

 

 3)@Import方式

(1)第一种,直接装配,可用逗号隔开添加多个

将类交给spring容器的3种办法

 

 (2)第二种,可集中管理,也可以将String数组中的数据放在配置文件中。

将类交给spring容器的3种办法

 将类交给spring容器的3种办法

 (3)第三种,可以带入一些参数

将类交给spring容器的3种办法

 将类交给spring容器的3种办法

 

 

相关文章:

  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2021-04-13
  • 2021-04-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
相关资源
相似解决方案