shiro如何允许favicon.ico通过
当使用springboot+maven+shiro进行授权登录时出现500错误,试了好几种方法,目前我只有构建一个单元方法这个可行;
error
2020-08-28 17:01:25.623 ERROR 4728 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template [favicon.ico], template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause
操作失败的方法
-
在application.yml配置文件中添加:
-
给路径授权:definition.addPathDefinition("/favicon.ico", “anon”);
最终解决方法
只需配置一个单元方法就可以了
@Controller
public class FaviconController {
@GetMapping("favicon.ico")
@ResponseBody
void returnNoFavicon() {
}
}