Advantages and disadvantages of XML configuration:
The advantages are:
1. The XML configuration method further reduces the coupling, making the application easier to extend, even if the configuration file is further modified and does not require engineering modification and recompilation.
2. When dealing with large volumes of traffic, it should be better to use XML configuration. Because XML is a clearer indication of the relationship between the various objects, calls between the various business classes. At the same time, the relevant configuration of spring can be at a glance.
Of course, some people will say that with XML configuration, the large volume of business will make the XML file too large, not easy to view. This allows us to write more than one XML configuration file with business decomposition.
3.xml, Care: The overall business relationship, maintainability.
Disadvantages are:
Configuration file reading and parsing takes a certain amount of time, too many configuration files are difficult to manage, the correctness of the configuration can not be verified, increasing the test difficulty.
Advantages and disadvantages of annotation configuration:
The advantages are:
1. In the class file, the maintenance cost can be reduced, the annotation configuration mechanism is obviously simple
2. No third-party parsing tools are required, and Java reflection technology is used to complete the task
3. Editing period can verify correctness, error becomes easy
4. Improve development efficiency
Disadvantages are:
1. If you need to modify the annotation, then recompile the entire project
2. The relationship between business classes is not as easy to grasp as the XML configuration.
3. If more annotation in the program, directly affect the quality of code, the code of the brevity has a certain impact.
Comparison between the spring annotation mechanism and the XML configuration mechanism