fix: 修复访问 doc.html 接口文档,控制台报 No mapping for GET /favicon.ico 警告的问题

This commit is contained in:
Charles7c 2023-08-15 23:02:11 +08:00
parent b23b00d02a
commit 94f88bad22
3 changed files with 10 additions and 2 deletions

View File

@ -66,7 +66,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
.setCachePeriod(0);
registry.addResourceHandler(localStorageProperties.getAvatarPattern()).addResourceLocations(avatarUtl)
.setCachePeriod(0);
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/");
registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/")
.setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -281,11 +281,18 @@ limitations under the License.
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
<include>**/*.yml</include>
</includes>
<!-- 启用过滤,即替换对应资源中的变量 -->
<filtering>true</filtering>
</resource>
<!-- 除 YAML 配置文件外,其他配置文件不需要进行变量替换 -->
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
</build>