File tree 2 files changed +22
-1
lines changed
src/main/java/org/springframework/data/auditing
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 19
19
20
20
import org .apache .commons .logging .Log ;
21
21
import org .apache .commons .logging .LogFactory ;
22
-
23
22
import org .springframework .beans .factory .InitializingBean ;
24
23
import org .springframework .data .domain .AuditorAware ;
24
+ import org .springframework .data .mapping .context .MappingContext ;
25
25
import org .springframework .data .mapping .context .PersistentEntities ;
26
26
import org .springframework .util .Assert ;
27
27
@@ -53,6 +53,16 @@ public AuditingHandler(PersistentEntities entities) {
53
53
this .auditorAware = Optional .empty ();
54
54
}
55
55
56
+ /**
57
+ * Factory method that creates a new {@link AuditingHandler} for the given {@link MappingContext}.
58
+ *
59
+ * @param mappingContext must not be {@literal null}.
60
+ * @since 3.0
61
+ */
62
+ public static AuditingHandler from (MappingContext <?, ?> mappingContext ) {
63
+ return new AuditingHandler (PersistentEntities .of (mappingContext ));
64
+ }
65
+
56
66
/**
57
67
* Setter to inject a {@code AuditorAware} component to retrieve the current auditor.
58
68
*
Original file line number Diff line number Diff line change 18
18
import reactor .core .publisher .Mono ;
19
19
20
20
import org .springframework .data .domain .ReactiveAuditorAware ;
21
+ import org .springframework .data .mapping .context .MappingContext ;
21
22
import org .springframework .data .mapping .context .PersistentEntities ;
22
23
import org .springframework .util .Assert ;
23
24
@@ -42,6 +43,16 @@ public ReactiveAuditingHandler(PersistentEntities entities) {
42
43
super (entities );
43
44
}
44
45
46
+ /**
47
+ * Factory method that creates a new {@link ReactiveAuditingHandler} for the given {@link MappingContext}.
48
+ *
49
+ * @param mappingContext must not be {@literal null}.
50
+ * @since 3.0
51
+ */
52
+ public static ReactiveAuditingHandler from (MappingContext <?, ?> mappingContext ) {
53
+ return new ReactiveAuditingHandler (PersistentEntities .of (mappingContext ));
54
+ }
55
+
45
56
/**
46
57
* Setter to inject a {@link ReactiveAuditorAware} component to retrieve the current auditor.
47
58
*
You can’t perform that action at this time.
0 commit comments