Selection of Spring configuration files in the project (XML and annotation choices)

Source: Internet
Author: User

The thing to change with the XML does not change things with annotations; This is a good solution for using annotations or XML.

XML Usage Scenario:1. The external jar package relies on the bean configuration 2. Scenarios that cannot be implemented with annotations or that cannot be easily implemented with annotations 3. Place of agreement within the project group 4. Special configuration (such as: Define a map) Excellent: Easy to edit, configuration comparison centralized, easy to modify, in the large business volume of the system, through the XML configuration will be convenient for future generations to understand the whole system of the lack of architecture: more cumbersome, type unsafe, configuration is ugly, configuration file too many times difficult to manage

Annotation Usage Scenario: In addition to the above 4 points, other conditions can be used excellent: convenient, concise, configuration information and Java code together to help enhance the cohesion of the program. Missing: Dispersed to each class file, so it is not appropriate to maintain

Selection of Spring configuration files in the project (XML and annotation choices)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.