Home >Java >javaTutorial >How to implement default static path in springboot

How to implement default static path in springboot

WBOY
WBOYforward
2023-05-11 12:58:06965browse

Class ResourceProperties.class

private static final String[] CLASSPATH_RESOURCE_LOCATIONS = new String[]{"classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"};
private String[] staticLocations;

public ResourceProperties() {
 this.staticLocations = CLASSPATH_RESOURCE_LOCATIONS;
 this.addMappings = true;
 this.chain = new ResourceProperties.Chain();
 this.cache = new ResourceProperties.Cache();
}

According to the construction method, staticLocations is equal to the default CLASSPATH_RESOURCE_LOCATIONS, that is, "classpath:/META-INF/ resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"

classpath is our resource folder as shown below

How to implement default static path in springboot

The above is the detailed content of How to implement default static path in springboot. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete