mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 20:57:23 +08:00
refactor: 新增 PATH_PATTERN 字符串常量
This commit is contained in:
@@ -58,4 +58,9 @@ public class StringConstants implements StrPool {
|
|||||||
* 中文逗号
|
* 中文逗号
|
||||||
*/
|
*/
|
||||||
public static final String CHINESE_COMMA = ",";
|
public static final String CHINESE_COMMA = ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路径模式
|
||||||
|
*/
|
||||||
|
public static final String PATH_PATTERN = "/**";
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ public class LocalStorageAutoConfiguration implements WebMvcConfigurer {
|
|||||||
if (StrUtil.isBlank(location)) {
|
if (StrUtil.isBlank(location)) {
|
||||||
throw new IllegalArgumentException(String.format("Path pattern [%s] location is null.", pathPattern));
|
throw new IllegalArgumentException(String.format("Path pattern [%s] location is null.", pathPattern));
|
||||||
}
|
}
|
||||||
registry.addResourceHandler(pathPattern)
|
registry.addResourceHandler(StrUtil.appendIfMissing(pathPattern, StringConstants.PATH_PATTERN))
|
||||||
.addResourceLocations(!location.startsWith("file:") ? String.format("file:%s", this.format(location)) : this.format(location))
|
.addResourceLocations(!location.startsWith("file:") ? String.format("file:%s", this.format(location)) : this.format(location))
|
||||||
.setCachePeriod(0);
|
.setCachePeriod(0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user