TransactionTemplate equality for same transaction manager only

Issue: SPR-16572
This commit is contained in:
Juergen Hoeller
2018-03-09 09:39:45 +01:00
parent cf74b1b8be
commit df8061494c
3 changed files with 32 additions and 4 deletions

View File

@@ -259,7 +259,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
*/
@Override
public boolean equals(Object other) {
return (other instanceof TransactionDefinition && toString().equals(other.toString()));
return (this == other || (other instanceof TransactionDefinition && toString().equals(other.toString())));
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -178,4 +178,11 @@ public class TransactionTemplate extends DefaultTransactionDefinition
}
}
@Override
public boolean equals(Object other) {
return (this == other || (super.equals(other) && (!(other instanceof TransactionTemplate) ||
getTransactionManager() == ((TransactionTemplate) other).getTransactionManager())));
}
}