Spring classpath prefix difference

前端 未结 4 724
滥情空心
滥情空心 2020-11-28 00:51

Documented here it states

This special prefix specifies that all classpath resources that match the given name must be obtained (internally, thi

4条回答
  •  死守一世寂寞
    2020-11-28 01:23

    The classpath*:... syntax is useful primarily when you want to build an application context from multiple bean definition files, using wildcard syntax.

    For example, if you construct your context using classpath*:appContext.xml, the classpath will be scanned for every resource called appContext.xml in the classpath, and the bean definitions from all of them merged into a single context.

    In contrast, classpath:conf/appContext.xml will obtain one and only one file called appContext.xml from the the classpath. If there is more than one, the others will be ignored.

提交回复
热议问题