I'm learnig Spring framework. I want ask about configuration style. If XML configuration is not deprecated. When better option is using annotation config and xml config? I read for bigger beans better is xml, but it was five years ago.
-
I would always prefer using annotation based config, but i think there would still be situations in which an xml based config is required, for example when you'd like to dynamically configure a spring application from a remote source, i would image the source to generate and xml file based on specific choices / requirements and use it to configure the spring application.– MssmCommented May 20, 2021 at 11:46
1 Answer
XML configuration is still officially supported by Spring. However, in practice, you can see it here and there, but in general its considered outdated by the community (ok this can be an arguable statement, so I'll state that its solely my opinion to be "on the safe side").
One example where XML configuration is still in use is large old projects (usually enterprises) that were started long time ago in the XML configuration era.
In a nutshell, for the learning purposes annotation based configurations is the way to go.
The good news are that spring is way more than the configuration, so if you'll understand how it works and what can be done with this framework, you'll be able to quickly switch from XML based configurations to Java config or annotations and the other way around