1. Refused to execute script from '....js' because its MIME type ('text/html') is not executable...
引用博客:https://blog.youkuaiyun.com/c4jem/article/details/77131422
该问题是因为加了权限验证导致默认不需要权限验证的静态文件例如css js等也被拦截导致http 302了,解决办法,在安全配置类的方法中增加过滤:
@Override
protected void configure(HttpSecurity http) throws Exception {
// http.authorizeRequests()每个匹配器按照它们被声明的顺序被考虑。
http
.authorizeRequests()
// 所有用户均可访问的资源
.antMatchers("/css/**", "/js/**","/images/**", "/webjars/**", "**/favicon.ico", "/index").permitAll()
// ROLE_USER的权限才能访问的资源
.antMatchers("/user/**").hasRole("USER")
// 任何尚未匹配的URL只需要验证用户即可访问
.anyRequest().authenticated()