Spring's classpath wildcard loading configuration file

 

classpath:app-Beans.xml

Description: No wildcards, must match exactly
 
classpath:App?-Beans.xml
Description: Match a character, such as App1-Beans.xml, App2-Beans.xml
 
classpath:user/*/Base-Beans.xml
Description: matches zero or more strings (only for names, does not match directory separators, etc.), for example: user/a/Base-Beans.xml , user/b/Base-Beans.xml , but does not match user/ Base-Beans.xml
 
classpath:user/**/Base-Beans.xml
Description: Match zero or more directories in the path, for example: user/a/ab/abc/Base-Beans.xml, and also match user/Base-Beans.xml
 
classpath:**/*-Beans.xml
Description: Indicates that the configuration files whose file names end with "-Beans.xml" are searched and loaded in all class paths, but only one of the duplicate file names is loaded, depending on the loading order.
 
classpath*:user/**/*-Beans.xml
classpath*:**/*-Beans.xml
Description: "classpath*:" means to load multiple resource files, even if they have the same name, they will be loaded. For example, there is a config-Beans.xml in app1.jar and a config-Beans.xml in app2.jar. At this time, Both will load.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326166520&siteId=291194637