为什么BCryptPasswordEncoder的强度会影响服务器的启动时间?在启动时没有生成哈希,所以我想知道为什么这对启动有任何影响。BCryptPasswordEncoder影响服务器的启动时间
当然,我知道检查密码是否匹配需要时间,但在启动时很奇怪。
代码如下所示:
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder(17); // Affects startup time tremendously
}
@Autowired
BCryptPasswordEncoder bcryptEncoder;
@Autowired
CustomUserDetailsService userDetailsService;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService)
.passwordEncoder(bcryptEncoder);
}
取决于我定义的力度。例如17,启动服务器需要花费+ -5分钟。 – Kramer