DATAMONGO-2586 - Add support for reactive auditing.

We now provide a fully reactive variant for auditing with EnableReactiveMongoAuditing.

Original Pull Request: #877
This commit is contained in:
Mark Paluch
2020-07-14 11:23:31 +02:00
committed by Christoph Strobl
parent 2c1a3cf03e
commit 6bafcea539
10 changed files with 300 additions and 105 deletions

View File

@@ -1,6 +1,11 @@
[[new-features]]
= New & Noteworthy
[[new-features.3.1]]
== What's New in Spring Data MongoDB 3.1
* <<mongo.auditing,Reactive auditing>> enabled through `@EnableReactiveMongoAuditing`. `@EnableMongoAuditing` no longer registers `ReactiveAuditingEntityCallback`.
[[new-features.3.0]]
== What's New in Spring Data MongoDB 3.0

View File

@@ -30,3 +30,22 @@ To activate auditing functionality via XML, add the Spring Data Mongo `auditing`
----
====
If you wish to use auditing with the reactive programming model, then enable auditing through `@EnableReactiveMongoAuditing`
.Activating auditing using JavaConfig
====
[source,java]
----
@Configuration
@EnableReactiveMongoAuditing
class Config {
@Bean
public ReactiveAuditorAware<AuditableUser> myAuditorProvider() {
return new AuditorAwareImpl();
}
}
----
====
If you expose a bean of type `ReactiveAuditorAware` to the `ApplicationContext`, the auditing infrastructure picks it up automatically 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 `@EnableReactiveMongoAuditing`.