0
不幸的是,我斯塔克。 情況:我的應用程序運行良好,但是當我裝它與Spring-開機安全性,所有的CSS,JS,IMG文件夾變得不可訪問....彈簧啓動:文件系統故障 - 配置
我試圖採用MVCConfig性質在我的application.properties文件中,但它沒有工作。 :( (spring.mvc.static路徑模式= /資源/ **)
不幸的是,我斯塔克。 情況:我的應用程序運行良好,但是當我裝它與Spring-開機安全性,所有的CSS,JS,IMG文件夾變得不可訪問....彈簧啓動:文件系統故障 - 配置
我試圖採用MVCConfig性質在我的application.properties文件中,但它沒有工作。 :( (spring.mvc.static路徑模式= /資源/ **)
你必須創建一個WebSecurityConfigurerAdapter
類設置的安全設置。請注意,你需要如下指定未受保護的URL。
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/", "/assets/**", "/favicon.ico").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
}
}
謝謝,它爲我工作!:) – lombocska