Skip to content

Commit c087e51

Browse files
committed
AbstractFallbackTransactionAttributeSource's DefaultCacheKey takes targetClass into account (again)
Issue: SPR-12536 (cherry picked from commit 4efe6a8)
1 parent 9cb1569 commit c087e51

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -213,13 +213,14 @@ public boolean equals(Object other) {
213213
return false;
214214
}
215215
DefaultCacheKey otherKey = (DefaultCacheKey) other;
216-
return (this.method.equals(otherKey.method) && ObjectUtils.nullSafeEquals(this.targetClass,
217-
otherKey.targetClass));
216+
return (this.method.equals(otherKey.method) &&
217+
ObjectUtils.nullSafeEquals(this.targetClass, otherKey.targetClass));
218218
}
219219

220220
@Override
221221
public int hashCode() {
222-
return this.method.hashCode() * 29 + (this.targetClass != null ? this.targetClass.hashCode() : 0);
222+
return this.method.hashCode() + (this.targetClass != null ? this.targetClass.hashCode() * 29 : 0);
223223
}
224224
}
225+
225226
}

spring-tx/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -227,7 +227,7 @@ public boolean equals(Object other) {
227227

228228
@Override
229229
public int hashCode() {
230-
return this.method.hashCode();
230+
return this.method.hashCode() + (this.targetClass != null ? this.targetClass.hashCode() * 29 : 0);
231231
}
232232
}
233233

0 commit comments

Comments
 (0)