審計

為了啟用審計功能,請在您的配置中新增 @EnableJdbcAuditing,示例如下:

透過 Java 配置啟用審計
@Configuration
@EnableJdbcAuditing
class Config {

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

如果您將型別為 AuditorAware 的 bean 暴露給 ApplicationContext,審計基礎設施會自動將其獲取並用於確定當前使用者以設定到域型別上。如果您在 ApplicationContext 中註冊了多個實現,可以透過顯式設定 @EnableJdbcAuditingauditorAwareRef 屬性來選擇要使用哪一個。

© . This site is unofficial and not affiliated with VMware.