要激活审核,请添加到您的配置中,如以下示例所示:@EnableJdbcAuditingSpring中文文档

使用 Java 配置激活审计
@Configuration
@EnableJdbcAuditing
class Config {

  @Bean
  AuditorAware<AuditableUser> auditorProvider() {
    return new AuditorAwareImpl();
  }
}

如果将 类型的 Bean 公开给 ,则审计基础结构会自动选取该 Bean 并使用它来确定要在域类型上设置的当前用户。 如果在 中注册了多个实现,则可以通过显式设置 的属性来选择要使用的实现。AuditorAwareApplicationContextApplicationContextauditorAwareRef@EnableJdbcAuditingSpring中文文档