DATAREDIS-538 - Allow @TimeToLive methods that are not accessible by default.

We allow now the use of non-public classes with a @TimeToLive method and @TimeToLive on non-public methods.

Original Pull Request: #231
This commit is contained in:
Mark Paluch
2016-07-20 15:30:18 +02:00
committed by Christoph Strobl
parent 54229d2388
commit e62ecbb1a9
2 changed files with 29 additions and 0 deletions

View File

@@ -53,6 +53,7 @@ import org.springframework.util.StringUtils;
*
* @author Christoph Strobl
* @author Oliver Gierke
* @author Mark Paluch
* @since 1.7
*/
public class RedisMappingContext extends KeyValueMappingContext<RedisPersistentEntity<?>, RedisPersistentProperty> {
@@ -256,6 +257,10 @@ public class RedisMappingContext extends KeyValueMappingContext<RedisPersistentE
Method timeoutMethod = resolveTimeMethod(type);
if (timeoutMethod != null) {
if (!timeoutMethod.isAccessible()) {
ReflectionUtils.makeAccessible(timeoutMethod);
}
TimeToLive ttl = AnnotationUtils.findAnnotation(timeoutMethod, TimeToLive.class);
try {
Number timeout = (Number) timeoutMethod.invoke(source);