使用springboot整合springsecurity自定义登录界面 发现自定义界面的静态资源没加载进来 浏览器报302
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private LoginUserDetailsService LUDS;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/css/**,/js/**,/img/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.successForwardUrl("/main_home")
.permitAll().and().csrf().disable();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(LUDS).passwordEncoder(password());
}
@Bean
PasswordEncoder password(){
return new BCryptPasswordEncoder();
}
}
浏览器控制台报错代码
login:1 Refused to apply style from 'http://localhost:25080/login' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
login:1 Refused to apply style from 'http://localhost:25080/login' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
login:1 Refused to execute script from 'http://localhost:25080/login' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login:1 Refused to execute script from 'http://localhost:25080/login' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login:1 Refused to execute script from 'http://localhost:25080/login' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
login:1 Refused to apply style from 'http://localhost:25080/login' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
login:1 Refused to apply style from 'http://localhost:25080/login' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
出错代码302