Skip to content

Commit 9cf4844

Browse files
authored
Fix auditing. (#1971)
Closes #1967.
1 parent 10ffd42 commit 9cf4844

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/org/springframework/data/couchbase/core/mapping/event/AuditingEventListener.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* @author Mark Paluch
3636
* @author Michael Reiche
3737
*/
38-
public class AuditingEventListener implements ApplicationListener<CouchbaseMappingEvent<Object>> {
38+
public class AuditingEventListener implements ApplicationListener<CouchbaseMappingEvent<?>> {
3939

4040
private final ObjectFactory<Object> auditingHandlerFactory;
4141

@@ -54,14 +54,20 @@ public AuditingEventListener() {
5454
public AuditingEventListener(ObjectFactory<Object> auditingHandlerFactory) {
5555
Assert.notNull(auditingHandlerFactory, "auditingHandlerFactory must not be null!");
5656
this.auditingHandlerFactory = auditingHandlerFactory;
57+
Object o = auditingHandlerFactory.getObject();
58+
if(!(o instanceof IsNewAwareAuditingHandler)){
59+
LOG.warn("auditingHandler IS NOT an IsNewAwareAuditingHandler: {}",o);
60+
} else {
61+
LOG.info("auditingHandler IS an IsNewAwareAuditingHandler: {}",o);
62+
}
5763
}
5864

59-
/*
65+
/**
6066
* (non-Javadoc)
61-
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
67+
* @see {@link org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)}
6268
*/
6369
@Override
64-
public void onApplicationEvent(CouchbaseMappingEvent<Object> event) {
70+
public void onApplicationEvent(CouchbaseMappingEvent<?> event) {
6571
if (event instanceof BeforeConvertEvent) {
6672
IsNewAwareAuditingHandler h = auditingHandlerFactory != null
6773
&& auditingHandlerFactory.getObject() instanceof IsNewAwareAuditingHandler

0 commit comments

Comments
 (0)