abel533 / Mapper

Mybatis Common Mapper - Easy to use
https://mybatis.io
MIT License
7.34k stars 1.63k forks source link

use PasswordEncoder passwordEncoder An error occurred #921

Closed itl-coder closed 1 week ago

itl-coder commented 3 months ago

@Autowired private PasswordEncoder passwordEncoder;

public void InitUserInfo() { log.info("init auth userInfo.............................");

    SysUser sysUser = new SysUser();

    String encode = passwordEncoder.encode("1234");
    sysUser.setId(1);
    sysUser.setUsername("user");
      // TODO:  java.lang.IllegalArgumentException: Illegal group reference
    sysUser.setPassword(encode);
    sysUserMapper.updateById(sysUser);
}
abel533 commented 3 months ago

执行的时机过早导致的,可以试试lazy能不能行,如果不行,就把这部分方法单独提供,不用通用方法。