解决SpringBoot不展示iconfont图标问题

木来 木来

经过初步排查,发现springboot无法访问到icon的woff等文件,造成图标没办法显示成功。

我的解决方案是在pom.xml中添加以下代码


<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <includes>

                <include>**/*.properties</include>
                <include>**/*.xml</include>
                <include>**/*.yml</include>
                <include>**/*.html</include>
                <include>**/*.js</include>
                <include>**/*.css</include>
                <include>**/*.ico</include>
                <include>**/*.png</include>
                <include>**/*.jpg</include>
                <include>**/*.ftl</include>
                <include>**/*.drl</include>
                <include>**/*.vm</include>
                <include>**/*.eot</include>
                <include>**/*.json</include>
                <include>**/*.svg</include>
                <include>**/*.ttf</include>
                <include>**/*.woff</include>
                <include>**/*.woff2</include>


            </includes>
        </resource>
    </resources>








    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

即可解决问题,必须添加全部的include,并且根据自己项目的文件进行删减。

0 条评论