Refined logging to include target class for each transactional method name

Also simplified cache key 'hashCode' implementation, relying on 'equals' to differentiate between same method on different target classes.

Issue: SPR-11267
This commit is contained in:
Juergen Hoeller 2014-01-01 18:36:48 +01:00
parent f0d21510f5
commit 82ea9ece5c
1 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -104,7 +104,9 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
} }
else { else {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Adding transactional method '" + method.getName() + "' with attribute: " + txAtt); Class<?> classToLog = (targetClass != null ? targetClass : method.getDeclaringClass());
logger.debug("Adding transactional method '" + classToLog.getSimpleName() + "." +
method.getName() + "' with attribute: " + txAtt);
} }
this.attributeCache.put(cacheKey, txAtt); this.attributeCache.put(cacheKey, txAtt);
} }
@ -225,7 +227,7 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
@Override @Override
public int hashCode() { public int hashCode() {
return this.method.hashCode() * 29 + (this.targetClass != null ? this.targetClass.hashCode() : 0); return this.method.hashCode();
} }
} }