refactor: 新增 PATH_PATTERN 字符串常量

This commit is contained in:
2023-12-28 21:42:47 +08:00
parent 7023be1072
commit 76e282c796
2 changed files with 6 additions and 1 deletions

View File

@@ -58,4 +58,9 @@ public class StringConstants implements StrPool {
* 中文逗号
*/
public static final String CHINESE_COMMA = "";
/**
* 路径模式
*/
public static final String PATH_PATTERN = "/**";
}

View File

@@ -57,7 +57,7 @@ public class LocalStorageAutoConfiguration implements WebMvcConfigurer {
if (StrUtil.isBlank(location)) {
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))
.setCachePeriod(0);
}