在
@PrePersist和
@PreUpdate阶段调用AuditingEntityListener方法。
这意味着它们将在执行插入或更新SQL语句之前被调用。
在Hibernate文档中了解有关JPA事件的更多信息:https :
//docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#events-
jpa-
callbacks
单元测试
在测试中使用时,您还必须在测试中启用审核
@DataJpaTest@RunWith(SpringRunner.class)@EnableJpaAuditingpublic class EntityListenerTest {


