Bootstrap 出现不需要的默认登录界面

1hdlvixo  于 2022-12-16  发布在  Bootstrap
关注(0)|答案(1)|浏览(152)

我启动了一个Springboot应用程序,希望创建一个登录/注册Webapp。
我只为HTML模板设置了Thymeleaf和Bootstrap,并设置了服务、控制器和存储库。
这是第一次显示此登录界面,每当我更改URL时,它都会返回到localhost:8080/login
我确保在当前项目上设置了端口,并且没有为/login设置请求
x1c 0d1x它看起来像是为它设置了一个后端,我不理解它在哪里...

uurity8g

uurity8g1#

这是从Springboot安全自动配置,我不得不禁用它手动添加一个配置类:

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter
{
    @Override
    protected void configure(HttpSecurity security) throws Exception
    {
     //security.httpBasic().disable(); // Did work only for GET     
     security.csrf().disable().authorizeRequests().anyRequest().permitAll(); // Works for GET, POST, PUT, DELETE
    }
}

相关问题