Springboot 2.x版本修改 favicon.ico 图标

在2.x以前的版本。直接将你需要的favicon.ico文件倒挡static下面就可以。

2.X以后的版本,消息了自动配置,需要人手动去在每一个页面添加;

加到thymeleaf

<!DOCTYPE html>

<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>

<meta charset="UTF-8"/>

<title>Hello Favicon</title>

<link rel="icon" th:href="@{/favicon.ico}" type="image/x-icon"/>

<link rel="bookmark" th:href="@{/favicon.ico}" type="image/x-icon"/>

</head>

<body>

<h1>Hello Favicon!</h1>

</body>

</html>

别的模板

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="icon" href="/Favicon.ico" type="image/x-icon"/>

    <link rel="bookmark" href="/Favicon.ico" type="image/x-icon"/>
</head>
<body>
 <h1>首页</h1>
</body>
</html>
发布了92 篇原创文章 · 获赞 92 · 访问量 20万+

猜你喜欢

转载自blog.csdn.net/qq_34359363/article/details/104755483