We provide @CreatedBy, @LastModifiedBy to capture the user who created or modified the entity as well as @CreatedDate and @LastModifiedDate to capture the point in time this happened.
当使用@CreatedBy时会使用下用户名
@Component
public class SpringSecurityAuditorAware implements AuditorAware<String> {
@Override
public String getCurrentAuditor() {
return "shangzebei";
}
}
如果类实现了AuditorAware程序就会自动使用此类的实例,如果有多个同时实现就可以通过@EnableJpaAuditing中auditorAwareRef指定