refactor: 优化字符串模板方法 API 使用

This commit is contained in:
2024-02-18 22:44:06 +08:00
parent 89108ad55a
commit c9867844b6
12 changed files with 16 additions and 16 deletions

View File

@@ -58,11 +58,11 @@ public class LocalStorageAutoConfiguration implements WebMvcConfigurer {
String pathPattern = mapping.getPathPattern();
String location = mapping.getLocation();
if (CharSequenceUtil.isBlank(location)) {
throw new IllegalArgumentException(String.format("Path pattern [%s] location is null.", pathPattern));
throw new IllegalArgumentException("Path pattern [%s] location is null.".formatted(pathPattern));
}
registry.addResourceHandler(CharSequenceUtil.appendIfMissing(pathPattern, StringConstants.PATH_PATTERN))
.addResourceLocations(!location.startsWith("file:")
? String.format("file:%s", this.format(location))
? "file:%s".formatted(this.format(location))
: this.format(location))
.setCachePeriod(0);
}