[js-spring] Specifying multiple Spring profiles for an app

Source: Internet
Author: User

Specify multiple profiles of equal relationships for Spring

The first way: The wildcard specifies the file (which is why we recommend naming all the configuration files for a rule)

Second way: Load multiple configuration paths, using ApplicationContext variable-length parameter construction method

The third way: similar to the second, but called the constructor of the ApplicationContext parameter as a string array

//load Spring configuration file, create Spring container object//The first wayString resource = "Com/neu/di15/spring-*.xml"; ApplicationContext AC=NewClasspathxmlapplicationcontext (Resource);/*the second way string Resource1 = "Com/neu/di15/spring-base.xml"; String Resource2 = "Com/neu/di15/spring-beans.xml"; ApplicationContext ac = new Classpathxmlapplicationcontext (Resource1, Resource2); *//*the Third Way string Resource1 = "Com/neu/di15/spring-base.xml"; String Resource2 = "Com/neu/di15/spring-beans.xml"; string[] Resources = {Resource1, resource2}; ApplicationContext ac = new Classpathxmlapplicationcontext (resources);*/

Specify multiple configuration files that contain relationships for Spring

You can import sub-profiles in the overall configuration file, either individually or by wildcards

<!---<resource= "Spring-*.xml"/> 

[js-spring] Specifying multiple Spring profiles for an app

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.