Last night, when I was doing something I was interested in, I found that the browser alarm failed to decode downloaded font and OTS parsing error: failed to convert * * * font to * * *.
However, I have never encountered this problem. After looking for the answer on the Internet for a while, I found a similar question. Some netizens guessed that the interceptor failed, so I checked Shiro’s interception configuration:
<property name="filterChainDefinitions"> <value> /=authc /index=authc /logout=logout /assets/** = anon /css/** = anon /fonts/**=anon /img/**=anon /**= user </value> </property>
But this configuration is theoretically OK, so it’s not this problem.
After consulting some materials today, we found the possible reasons:
When Maven’s filter parses the font file, it destroys the binary file format of the font file, resulting in browser parsing errors.
The solution is: the font file does not need a filter, so we need to set it in the configuration (springboot is written in pom.xml):
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> <resources> <!-- fonts file cannot use filter as the data structure of byte file will be changed via filter --> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <excludes> <exclude>static/fonts/**</exclude> </excludes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <includes> <include>static/fonts/**</include> </includes> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build>
After the configuration shown above, Maven does not parse the font file when compiling the project, the browser will not give an alarm, and the font can be displayed normally.
- [Solved] Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
- The project is normal in eclipse, and an error is reported in IDEA [How to Solve]
- How to Solve Springboot OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
- MyBatis Error: Error building SqlSession [How to Solve]
- [Solved] Springboot Error: invalid bound statement (not found)
- [Solved] Could not find resource com/cth/dao/UserImpl.xml & Single mapping file not found
- [Solved] Mybatis Error: Invalid bound statement (not found)
- [Solved] Mybatis: the binding mapper cannot be found Error: Org.apache.ibatis.binding.bindingexception: invalid bound statement (not found)
- [Solved] SpringBoot Package Error: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-res
- Springboot introduces local jar package to deploy to server error [How to Solve]