对待保存用户的密码进行加密处理,可以使用框架提供给我们的加密类BCryptPasswordEncoder,对于该加密类的用法,我们可以直接将其交给ioc容器管理,直接使用其encode()方法。即在springSecurity.xml配置文件中做如下配置:
<!-- 配置加密类 -->
<bean id="passwordEncoder"
class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"/>
使用时可直接使用passwordEncoder.