如果页面未引入thymeleaf
创建SpringBoot 2.2.6 web项目放入index.html静态网页时发现无法加载页面小图标(即将favicon.ico放到默认读取目录是不能加载到浏览器上了,在1.x中这个自动配置了。)。2.x没有自动配置,可根据以下方法修改(在需要加载的HTML网页head标签里):
<link rel="shortcut icon" href="/favicon1.ico"/>
<link rel="bookmark" href="/favicon1.ico"/>
需要注意的是favicon.ico需要改名字,不改名字的话不能加载成功。
如果页面引入thymeleaf
<link rel="shortcut icon" th:href="@{/favicon1.ico}"/>
<link rel="bookmark" th:href="@{/favicon1.ico}"/>