springboot jpa 审计

@SpringBootApplication

@EnableJpaAuditing

public class Application {...}

@Component

public class AuditorAwareImpl implements AuditorAware<String> {

public String getCurrentAuditor() {

return "aaa";

}

}

@Entity

@EntityListeners(AuditingEntityListener.class)

public class A {

@CreatedBy

private String addUser;

@LastModifiedBy

private String modifyUser;

@CreatedDate

private LocalDateTime addTime;

@LastModifiedDate

private LocalDateTime modifyTime;

}

上一篇:Java内存区域与对象创建过程


下一篇:MySql入门学习笔记