1. The default path of spring boot loading file:
We can also see from the spring boot source code:
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { "classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/" };2. Classpath meaning
Summary: This is an entrance to locate resources
Classpath exists in general Java projects with WEB-INFO/directory.
When we need a certain class, the system will automatically search in CLASSPATH. If it is a jar, it will automatically search from the jar. If it is an ordinary directory, it will search according to the package under the directory.
But unlike PATH, the default CLASSPATH does not contain the current directory, which is also the reason why CLASSPATH needs to include a point.
The web application under Tomcat has two preset classpaths: WEB-INF/classes and WEB-INF/lib to start the project, and the project will load the data in these two directories. This is the specification of the war package. It is more troublesome to change the preset classpath. No similar configuration is found in the Tomcat configuration file. You must implement your own classloader to achieve your goal.
A web application running in tomcat. Its classpath includes the following directory:
What I know is:
classpath in environment variables
Summary: classpath is an entry to locate resources. The priority of lib under classpath is greater than classes;
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.