Sobes.tech
Middle

Which configuration has priority: XML, Java, or annotations?

sobes.tech AI

Answer from AI

Configuration priority order in Spring (from lowest to highest, overriding previous ones):

  1. XML configuration
  2. JavaConfig
  3. Annotations (e.g., @Component, @Autowired, @Value, @Primary, @Qualifier)

Thus, annotations have the highest priority and can override configuration set in XML or JavaConfig. Element-level annotations (fields, methods, parameters) have a higher priority than class-level annotations.