我刚刚在静态文件夹中添加了所有的css和js文件,可以从url轻松访问,我该如何解决?我将此方法添加到我的安全配置
@Override
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers("/resources/**");
}
但它不起作用
答案 0 :(得分:0)
假设您不想公开/static/that/
文件夹的示例。
我建议您选择定义资源的白名单,而不是黑名单方法(如果您没有定义说/static/that/
)
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/this/,classpath:/public/ # Locations of static resources.
以上代码的异常,取自Spring Boot Documentation