我在webapp下新建了一个文件夹fonts,可是却一直跑不出来预期的字体效果。一开始我以为是路径写错了,但其实并没有写错。
新建的fonts文件夹里的内容一直读不出来。
后来,在大佬的指点下,才知道是因为配置文件没有修改。
打开spring-web.xml,添加静态资源文件访问配置即可:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.