可以混合用。文档有说明:
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会覆盖注解