For the latest stable version, please use Spring Data Relational 3.4.1! |
Auditing
In order to activate auditing, add @EnableJdbcAuditing
to your configuration, as the following example shows:
Activating auditing with Java configuration
@Configuration
@EnableJdbcAuditing
class Config {
@Bean
AuditorAware<AuditableUser> auditorProvider() {
return new AuditorAwareImpl();
}
}
If you expose a bean of type AuditorAware
to the ApplicationContext
, the auditing infrastructure automatically picks it up and uses it to determine the current user to be set on domain types.
If you have multiple implementations registered in the ApplicationContext
, you can select the one to be used by explicitly setting the auditorAwareRef
attribute of @EnableJdbcAuditing
.