Why do we need to write "*" after classpath Here's an example
<import resource="classpath*:META-INF/spring/config.xml"/>
That's a regex pattern (specially for spring) which means match rest of the location path
.
Here in your case match all config.xml
files in META-INF/spring
folders of your classpath.
Here the Spring reference which exaplains it better in better way
4.7.2 Wildcards in application context constructor resource paths
The resource paths in application context constructor values may be a simple path (as shown above) which has a one-to-one mapping to a target Resource, or alternately may contain the special "classpath*:" prefix and/or internal Ant-style regular expressions (matched using Spring's PathMatcher utility). Both of the latter are effectively wildcards
The classpath*:
prefix means that, instead of just retrieving the first entry from the specified classpath location, all such entries will be used and merged together. Since each component (JAR) can contribute its own resource on the same classpath location, this makes it possible for each component to contribute its definitions into a common resource.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With