when I use spring boot banner configuration file, I find that:
spring.banner.location=classpath:banner.txt
spring.banner.location=classpath*:banner.txt
So what is the difference between classpath:
and classpath*:
?
From Spring documentation
The wildcard classpath relies on the getResources() method of the underlying classloader. As most application servers nowadays supply their own classloader implementation, the behavior might differ especially when dealing with jar files. A simple test to check if classpath* works is to use the classloader to load a file from within a jar on the classpath: getClass().getClassLoader().getResources(""). Try this test with files that have the same name but are placed inside two different locations. In case an inappropriate result is returned, check the application server documentation for settings that might affect the classloader behavior.
So classPath is for load the resources from current class loader (simply for understanding will not read resources under jar or other project dependency)
classpath* will do the jar or other class loader resources.