diff --git a/spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java b/spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java index f96c04c0718..e4b045b2310 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java +++ b/spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2017 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. @@ -85,7 +85,7 @@ public class TransactionAwareCacheDecorator implements Cache { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { - targetCache.put(key, value); + TransactionAwareCacheDecorator.this.targetCache.put(key, value); } }); } @@ -105,7 +105,7 @@ public class TransactionAwareCacheDecorator implements Cache { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { - targetCache.evict(key); + TransactionAwareCacheDecorator.this.targetCache.evict(key); } }); } diff --git a/spring-context-support/src/test/java/org/springframework/cache/transaction/TransactionAwareCacheDecoratorTests.java b/spring-context-support/src/test/java/org/springframework/cache/transaction/TransactionAwareCacheDecoratorTests.java index 151615db55a..ea1c194fee6 100644 --- a/spring-context-support/src/test/java/org/springframework/cache/transaction/TransactionAwareCacheDecoratorTests.java +++ b/spring-context-support/src/test/java/org/springframework/cache/transaction/TransactionAwareCacheDecoratorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2017 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. @@ -42,7 +42,7 @@ public class TransactionAwareCacheDecoratorTests { @Test public void createWithNullTarget() { - thrown.expect(IllegalArgumentException.class); + this.thrown.expect(IllegalArgumentException.class); new TransactionAwareCacheDecorator(null); } @@ -77,13 +77,13 @@ public class TransactionAwareCacheDecoratorTests { Cache target = new ConcurrentMapCache("testCache"); Cache cache = new TransactionAwareCacheDecorator(target); - TransactionStatus status = txManager.getTransaction(new DefaultTransactionAttribute( - TransactionDefinition.PROPAGATION_REQUIRED)); + TransactionStatus status = this.txManager.getTransaction( + new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED)); Object key = new Object(); cache.put(key, "123"); assertNull(target.get(key)); - txManager.commit(status); + this.txManager.commit(status); assertEquals("123", target.get(key, String.class)); } @@ -119,11 +119,11 @@ public class TransactionAwareCacheDecoratorTests { cache.put(key, "123"); - TransactionStatus status = txManager.getTransaction(new DefaultTransactionAttribute( - TransactionDefinition.PROPAGATION_REQUIRED)); + TransactionStatus status = this.txManager.getTransaction( + new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED)); cache.evict(key); assertEquals("123", target.get(key, String.class)); - txManager.commit(status); + this.txManager.commit(status); assertNull(target.get(key)); } @@ -147,11 +147,11 @@ public class TransactionAwareCacheDecoratorTests { cache.put(key, "123"); - TransactionStatus status = txManager.getTransaction(new DefaultTransactionAttribute( - TransactionDefinition.PROPAGATION_REQUIRED)); + TransactionStatus status = this.txManager.getTransaction( + new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED)); cache.clear(); assertEquals("123", target.get(key, String.class)); - txManager.commit(status); + this.txManager.commit(status); assertNull(target.get(key)); }