我在 Spring Boot 的应用程序中添加了一个自定义安全配置,但是关于“使用默认安全密码”的消息仍然存在于 LOG 文件中。
有什么可以删除的吗?我不需要这个默认密码。 Spring Boot 似乎无法识别我的安全策略。
@Configuration
@EnableWebSecurity
public class CustomSecurityConfig extends WebSecurityConfigurerAdapter {
private final String uri = "/custom/*";
@Override
public void configure(final HttpSecurity http) throws Exception {
http.csrf().disable();
http.headers().httpStrictTransportSecurity().disable();
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
// Authorize sub-folders permissions
http.antMatcher(uri).authorizeRequests().anyRequest().permitAll();
}
}
最佳答案
我找到了一个关于排除 SecurityAutoConfiguration 类的解决方案。
例子:
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class })
public class ReportApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(MyApplication.class, args);
}
}
关于java - 在 Spring Boot 上删除 "Using default security password",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30761253/