Junior — Middle
What will take priority in configuration: an XML file or the @Configuration annotation?
sobes.tech AI
Answer from AI
When determining configuration in the Spring Framework, the @Configuration annotation takes precedence over the XML file.
This is because annotation-based configuration is considered more modern and preferable. If both options are used simultaneously, the settings from classes with @Configuration will have priority and can override definitions from XML.
For example, if a bean with a certain name is defined in XML, and a bean with the same name is defined in a class with @Configuration, the bean from the class with the annotation will be used.
Thus, @Configuration has a higher priority when resolving configuration in Spring.