訪問項目的任意接口,都會跳轉到以下頁面
但是項目中,並沒有寫過前端的頁面。
想了想才發現,因爲項目中用到了SpringSecurity,而SpringSecurity默認給我們加了一個用戶認證的功能
用戶名是:user 密碼是在啓動的控制檯打印出來的:
解決方法:
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class SecurityConfigSEVEN extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
//super.configure(http);
//配置不需要登陸驗證
http.authorizeRequests().anyRequest().permitAll().and().logout().permitAll();
}
}