
如果您在启用 Spring Security 之前在 Spring Boot 中使用过 H2 控制台(无论有或没有 Vaadin),您可能会注意到添加 Spring Security 会阻止对数据库控制台的访问。要解决此问题,最简单的方法是重写 configure(WebSecurity web) 方法。请注意方法签名,因为还有一个 configure(HttpSecurity http) 方法,这对解决此问题没有帮助。
要重新获得对 H2 控制台的访问权限,您通常需要执行以下操作:
@覆盖
protected void configure(WebSecurity web) 抛出异常 {
网络
.ignoring()
.requestMatchers(new AntPathRequestMatcher("/h2-console/**"));
超级配置(网络);
}
仅此而已!
以上就是将 Honsole 与 Spring Security 结合使用的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号