Spring JPA Data Auditing

官方文檔
baeldung 示例

注意:
來自官方文檔:

If you have multiple implementations registered in the ApplicationContext, you can select the one to be used by explicitly setting the auditorAwareRef attribute of @EnableJpaAuditing.

示例:

@EnableJpaAuditing(auditorAwareRef="auditorProvider")
public class PersistenceConfig {

    ...

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

    ...

}
發佈了40 篇原創文章 · 獲贊 16 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章