可以混合用。文档有说明:

Spring can accommodate both styles and even mix them together.

混合用的话,有个先后顺序,xml配置会覆盖annotation。原文:

Annotation injection is performed before XML injection, thus the latter configuration will override the former for properties wired through both approaches.

 

 

也就是说对于同一个bean  不能注解完成部分属性的设定  xml完成部分属性的设定

xml会覆盖注解

 

相关文章:

  • 2021-09-14
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-09-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-16
  • 2021-06-29
  • 2021-08-27
  • 2022-12-23
  • 2021-09-09
相关资源
相似解决方案