Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
e2518e0b
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e2518e0b
编写于
11月 01, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduced DefaultJCacheOperationSource's dependency from ApplicationContext to BeanFactory
Issue: SPR-12336
上级
0e36402b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
80 addition
and
58 deletion
+80
-58
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/DefaultJCacheOperationSource.java
...ache/jcache/interceptor/DefaultJCacheOperationSource.java
+57
-41
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotationCacheOperationSourceTests.java
...ache/interceptor/AnnotationCacheOperationSourceTests.java
+21
-15
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheInterceptorTests.java
...work/cache/jcache/interceptor/JCacheInterceptorTests.java
+2
-2
未找到文件。
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/DefaultJCacheOperationSource.java
浏览文件 @
e2518e0b
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
package
org.springframework.cache.jcache.interceptor
;
package
org.springframework.cache.jcache.interceptor
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.NoSuchBeanDefinitionException
;
import
org.springframework.beans.factory.NoSuchBeanDefinitionException
;
import
org.springframework.beans.factory.NoUniqueBeanDefinitionException
;
import
org.springframework.beans.factory.NoUniqueBeanDefinitionException
;
...
@@ -26,8 +28,6 @@ import org.springframework.cache.interceptor.CacheResolver;
...
@@ -26,8 +28,6 @@ import org.springframework.cache.interceptor.CacheResolver;
import
org.springframework.cache.interceptor.KeyGenerator
;
import
org.springframework.cache.interceptor.KeyGenerator
;
import
org.springframework.cache.interceptor.SimpleCacheResolver
;
import
org.springframework.cache.interceptor.SimpleCacheResolver
;
import
org.springframework.cache.interceptor.SimpleKeyGenerator
;
import
org.springframework.cache.interceptor.SimpleKeyGenerator
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
/**
/**
...
@@ -39,19 +39,19 @@ import org.springframework.util.Assert;
...
@@ -39,19 +39,19 @@ import org.springframework.util.Assert;
* @since 4.1
* @since 4.1
*/
*/
public
class
DefaultJCacheOperationSource
extends
AnnotationJCacheOperationSource
public
class
DefaultJCacheOperationSource
extends
AnnotationJCacheOperationSource
implements
ApplicationContext
Aware
,
InitializingBean
,
SmartInitializingSingleton
{
implements
BeanFactory
Aware
,
InitializingBean
,
SmartInitializingSingleton
{
private
CacheManager
cacheManager
;
private
CacheManager
cacheManager
;
private
KeyGenerator
keyGenerator
=
new
SimpleKeyGenerator
();
private
KeyGenerator
adaptedKeyGenerator
;
private
CacheResolver
cacheResolver
;
private
CacheResolver
cacheResolver
;
private
CacheResolver
exceptionCacheResolver
;
private
CacheResolver
exceptionCacheResolver
;
private
ApplicationContext
applicationContext
;
private
KeyGenerator
keyGenerator
=
new
SimpleKeyGenerator
();
private
KeyGenerator
adaptedKeyGenerator
;
private
BeanFactory
beanFactory
;
/**
/**
...
@@ -63,16 +63,10 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
...
@@ -63,16 +63,10 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
}
}
/**
/**
* Set the default {@link KeyGenerator}. If none is set, a {@link SimpleKeyGenerator}
* Return the specified cache manager to use, if any.
* honoringKe the JSR-107 {@link javax.cache.annotation.CacheKey} and
* {@link javax.cache.annotation.CacheValue} will be used.
*/
*/
public
void
setKeyGenerator
(
KeyGenerator
keyGenerator
)
{
public
CacheManager
getCacheManager
()
{
this
.
keyGenerator
=
keyGenerator
;
return
this
.
cacheManager
;
}
public
KeyGenerator
getKeyGenerator
()
{
return
this
.
keyGenerator
;
}
}
/**
/**
...
@@ -83,8 +77,11 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
...
@@ -83,8 +77,11 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
this
.
cacheResolver
=
cacheResolver
;
this
.
cacheResolver
=
cacheResolver
;
}
}
/**
* Return the specified cache resolver to use, if any.
*/
public
CacheResolver
getCacheResolver
()
{
public
CacheResolver
getCacheResolver
()
{
return
getDefaultCacheResolver
()
;
return
this
.
cacheResolver
;
}
}
/**
/**
...
@@ -95,13 +92,32 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
...
@@ -95,13 +92,32 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
this
.
exceptionCacheResolver
=
exceptionCacheResolver
;
this
.
exceptionCacheResolver
=
exceptionCacheResolver
;
}
}
/**
* Return the specified exception cache resolver to use, if any.
*/
public
CacheResolver
getExceptionCacheResolver
()
{
public
CacheResolver
getExceptionCacheResolver
()
{
return
getDefaultExceptionCacheResolver
();
return
this
.
exceptionCacheResolver
;
}
/**
* Set the default {@link KeyGenerator}. If none is set, a {@link SimpleKeyGenerator}
* honoringKe the JSR-107 {@link javax.cache.annotation.CacheKey} and
* {@link javax.cache.annotation.CacheValue} will be used.
*/
public
void
setKeyGenerator
(
KeyGenerator
keyGenerator
)
{
this
.
keyGenerator
=
keyGenerator
;
}
/**
* Return the specified key generator to use, if any.
*/
public
KeyGenerator
getKeyGenerator
()
{
return
this
.
keyGenerator
;
}
}
@Override
@Override
public
void
set
ApplicationContext
(
ApplicationContext
applicationContext
)
{
public
void
set
BeanFactory
(
BeanFactory
beanFactory
)
{
this
.
applicationContext
=
applicationContext
;
this
.
beanFactory
=
beanFactory
;
}
}
...
@@ -121,7 +137,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
...
@@ -121,7 +137,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
@Override
@Override
protected
<
T
>
T
getBean
(
Class
<
T
>
type
)
{
protected
<
T
>
T
getBean
(
Class
<
T
>
type
)
{
try
{
try
{
return
this
.
applicationContext
.
getBean
(
type
);
return
this
.
beanFactory
.
getBean
(
type
);
}
}
catch
(
NoUniqueBeanDefinitionException
ex
)
{
catch
(
NoUniqueBeanDefinitionException
ex
)
{
throw
new
IllegalStateException
(
"No unique ["
+
type
.
getName
()
+
"] bean found in application context - "
+
throw
new
IllegalStateException
(
"No unique ["
+
type
.
getName
()
+
"] bean found in application context - "
+
...
@@ -135,10 +151,27 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
...
@@ -135,10 +151,27 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
}
}
}
}
protected
CacheManager
getDefaultCacheManager
()
{
if
(
this
.
cacheManager
==
null
)
{
try
{
this
.
cacheManager
=
this
.
beanFactory
.
getBean
(
CacheManager
.
class
);
}
catch
(
NoUniqueBeanDefinitionException
ex
)
{
throw
new
IllegalStateException
(
"No unique bean of type CacheManager found. "
+
"Mark one as primary or declare a specific CacheManager to use."
);
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
throw
new
IllegalStateException
(
"No bean of type CacheManager found. Register a CacheManager "
+
"bean or remove the @EnableCaching annotation from your configuration."
);
}
}
return
this
.
cacheManager
;
}
@Override
@Override
protected
CacheResolver
getDefaultCacheResolver
()
{
protected
CacheResolver
getDefaultCacheResolver
()
{
if
(
this
.
cacheResolver
==
null
)
{
if
(
this
.
cacheResolver
==
null
)
{
this
.
cacheResolver
=
new
SimpleCacheResolver
(
getCacheManager
());
this
.
cacheResolver
=
new
SimpleCacheResolver
(
get
Default
CacheManager
());
}
}
return
this
.
cacheResolver
;
return
this
.
cacheResolver
;
}
}
...
@@ -146,7 +179,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
...
@@ -146,7 +179,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
@Override
@Override
protected
CacheResolver
getDefaultExceptionCacheResolver
()
{
protected
CacheResolver
getDefaultExceptionCacheResolver
()
{
if
(
this
.
exceptionCacheResolver
==
null
)
{
if
(
this
.
exceptionCacheResolver
==
null
)
{
this
.
exceptionCacheResolver
=
new
SimpleExceptionCacheResolver
(
getCacheManager
());
this
.
exceptionCacheResolver
=
new
SimpleExceptionCacheResolver
(
get
Default
CacheManager
());
}
}
return
this
.
exceptionCacheResolver
;
return
this
.
exceptionCacheResolver
;
}
}
...
@@ -156,21 +189,4 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
...
@@ -156,21 +189,4 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
return
this
.
adaptedKeyGenerator
;
return
this
.
adaptedKeyGenerator
;
}
}
private
CacheManager
getCacheManager
()
{
if
(
this
.
cacheManager
==
null
)
{
try
{
this
.
cacheManager
=
this
.
applicationContext
.
getBean
(
CacheManager
.
class
);
}
catch
(
NoUniqueBeanDefinitionException
ex
)
{
throw
new
IllegalStateException
(
"No unique bean of type CacheManager found. "
+
"Mark one as primary or declare a specific CacheManager to use."
);
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
throw
new
IllegalStateException
(
"No bean of type CacheManager found. Register a CacheManager "
+
"bean or remove the @EnableCaching annotation from your configuration."
);
}
}
return
this
.
cacheManager
;
}
}
}
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/AnnotationCacheOperationSourceTests.java
浏览文件 @
e2518e0b
...
@@ -27,13 +27,13 @@ import javax.cache.annotation.CacheResult;
...
@@ -27,13 +27,13 @@ import javax.cache.annotation.CacheResult;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.beans.factory.support.DefaultListableBeanFactory
;
import
org.springframework.cache.interceptor.CacheResolver
;
import
org.springframework.cache.interceptor.CacheResolver
;
import
org.springframework.cache.interceptor.KeyGenerator
;
import
org.springframework.cache.interceptor.KeyGenerator
;
import
org.springframework.cache.jcache.AbstractJCacheTests
;
import
org.springframework.cache.jcache.AbstractJCacheTests
;
import
org.springframework.cache.jcache.support.TestableCacheKeyGenerator
;
import
org.springframework.cache.jcache.support.TestableCacheKeyGenerator
;
import
org.springframework.cache.jcache.support.TestableCacheResolver
;
import
org.springframework.cache.jcache.support.TestableCacheResolver
;
import
org.springframework.cache.jcache.support.TestableCacheResolverFactory
;
import
org.springframework.cache.jcache.support.TestableCacheResolverFactory
;
import
org.springframework.context.support.StaticApplicationContext
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
...
@@ -47,17 +47,19 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
...
@@ -47,17 +47,19 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
private
final
DefaultJCacheOperationSource
source
=
new
DefaultJCacheOperationSource
();
private
final
DefaultJCacheOperationSource
source
=
new
DefaultJCacheOperationSource
();
private
final
StaticApplicationContext
applicationContext
=
new
StaticApplicationContext
();
private
final
DefaultListableBeanFactory
beanFactory
=
new
DefaultListableBeanFactory
();
@Before
@Before
public
void
setUp
()
{
public
void
setUp
()
{
source
.
setApplicationContext
(
applicationContext
);
source
.
setKeyGenerator
(
defaultKeyGenerator
);
source
.
setCacheResolver
(
defaultCacheResolver
);
source
.
setCacheResolver
(
defaultCacheResolver
);
source
.
setExceptionCacheResolver
(
defaultExceptionCacheResolver
);
source
.
setExceptionCacheResolver
(
defaultExceptionCacheResolver
);
source
.
setKeyGenerator
(
defaultKeyGenerator
);
source
.
setBeanFactory
(
beanFactory
);
source
.
afterPropertiesSet
();
source
.
afterPropertiesSet
();
}
}
@Test
@Test
public
void
cache
()
{
public
void
cache
()
{
CacheResultOperation
op
=
getDefaultCacheOperation
(
CacheResultOperation
.
class
,
String
.
class
);
CacheResultOperation
op
=
getDefaultCacheOperation
(
CacheResultOperation
.
class
,
String
.
class
);
...
@@ -104,29 +106,29 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
...
@@ -104,29 +106,29 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
@Test
@Test
public
void
defaultCacheNameWithCandidate
()
{
public
void
defaultCacheNameWithCandidate
()
{
Method
m
=
ReflectionUtils
.
findMethod
(
Object
.
class
,
"toString"
);
Method
m
ethod
=
ReflectionUtils
.
findMethod
(
Object
.
class
,
"toString"
);
assertEquals
(
"foo"
,
source
.
determineCacheName
(
m
,
null
,
"foo"
));
assertEquals
(
"foo"
,
source
.
determineCacheName
(
m
ethod
,
null
,
"foo"
));
}
}
@Test
@Test
public
void
defaultCacheNameWithDefaults
()
{
public
void
defaultCacheNameWithDefaults
()
{
Method
m
=
ReflectionUtils
.
findMethod
(
Object
.
class
,
"toString"
);
Method
m
ethod
=
ReflectionUtils
.
findMethod
(
Object
.
class
,
"toString"
);
CacheDefaults
mock
=
mock
(
CacheDefaults
.
class
);
CacheDefaults
mock
=
mock
(
CacheDefaults
.
class
);
given
(
mock
.
cacheName
()).
willReturn
(
""
);
given
(
mock
.
cacheName
()).
willReturn
(
""
);
assertEquals
(
"java.lang.Object.toString()"
,
source
.
determineCacheName
(
m
,
mock
,
""
));
assertEquals
(
"java.lang.Object.toString()"
,
source
.
determineCacheName
(
m
ethod
,
mock
,
""
));
}
}
@Test
@Test
public
void
defaultCacheNameNoDefaults
()
{
public
void
defaultCacheNameNoDefaults
()
{
Method
m
=
ReflectionUtils
.
findMethod
(
Object
.
class
,
"toString"
);
Method
m
ethod
=
ReflectionUtils
.
findMethod
(
Object
.
class
,
"toString"
);
assertEquals
(
"java.lang.Object.toString()"
,
source
.
determineCacheName
(
m
,
null
,
""
));
assertEquals
(
"java.lang.Object.toString()"
,
source
.
determineCacheName
(
m
ethod
,
null
,
""
));
}
}
@Test
@Test
public
void
defaultCacheNameWithParameters
()
{
public
void
defaultCacheNameWithParameters
()
{
Method
m
=
ReflectionUtils
.
findMethod
(
Comparator
.
class
,
"compare"
,
Object
.
class
,
Object
.
class
);
Method
m
ethod
=
ReflectionUtils
.
findMethod
(
Comparator
.
class
,
"compare"
,
Object
.
class
,
Object
.
class
);
assertEquals
(
"java.util.Comparator.compare(java.lang.Object,java.lang.Object)"
,
assertEquals
(
"java.util.Comparator.compare(java.lang.Object,java.lang.Object)"
,
source
.
determineCacheName
(
m
,
null
,
""
));
source
.
determineCacheName
(
m
ethod
,
null
,
""
));
}
}
@Test
@Test
...
@@ -151,7 +153,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
...
@@ -151,7 +153,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
@Test
@Test
public
void
customKeyGeneratorSpringBean
()
{
public
void
customKeyGeneratorSpringBean
()
{
TestableCacheKeyGenerator
bean
=
new
TestableCacheKeyGenerator
();
TestableCacheKeyGenerator
bean
=
new
TestableCacheKeyGenerator
();
applicationContext
.
getBeanFactory
()
.
registerSingleton
(
"fooBar"
,
bean
);
beanFactory
.
registerSingleton
(
"fooBar"
,
bean
);
CacheResultOperation
operation
=
CacheResultOperation
operation
=
getCacheOperation
(
CacheResultOperation
.
class
,
CustomService
.
class
,
name
.
getMethodName
(),
Long
.
class
);
getCacheOperation
(
CacheResultOperation
.
class
,
CustomService
.
class
,
name
.
getMethodName
(),
Long
.
class
);
assertEquals
(
defaultCacheResolver
,
operation
.
getCacheResolver
());
assertEquals
(
defaultCacheResolver
,
operation
.
getCacheResolver
());
...
@@ -188,8 +190,9 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
...
@@ -188,8 +190,9 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
return
getCacheOperation
(
operationType
,
AnnotatedJCacheableService
.
class
,
name
.
getMethodName
(),
parameterTypes
);
return
getCacheOperation
(
operationType
,
AnnotatedJCacheableService
.
class
,
name
.
getMethodName
(),
parameterTypes
);
}
}
protected
<
T
extends
JCacheOperation
<?>>
T
getCacheOperation
(
Class
<
T
>
operationType
,
Class
<?>
targetType
,
protected
<
T
extends
JCacheOperation
<?>>
T
getCacheOperation
(
String
methodName
,
Class
<?>...
parameterTypes
)
{
Class
<
T
>
operationType
,
Class
<?>
targetType
,
String
methodName
,
Class
<?>...
parameterTypes
)
{
JCacheOperation
<?>
result
=
getCacheOperation
(
targetType
,
methodName
,
parameterTypes
);
JCacheOperation
<?>
result
=
getCacheOperation
(
targetType
,
methodName
,
parameterTypes
);
assertNotNull
(
result
);
assertNotNull
(
result
);
assertEquals
(
operationType
,
result
.
getClass
());
assertEquals
(
operationType
,
result
.
getClass
());
...
@@ -204,6 +207,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
...
@@ -204,6 +207,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
private
void
assertJCacheResolver
(
CacheResolver
actual
,
private
void
assertJCacheResolver
(
CacheResolver
actual
,
Class
<?
extends
javax
.
cache
.
annotation
.
CacheResolver
>
expectedTargetType
)
{
Class
<?
extends
javax
.
cache
.
annotation
.
CacheResolver
>
expectedTargetType
)
{
if
(
expectedTargetType
==
null
)
{
if
(
expectedTargetType
==
null
)
{
assertNull
(
actual
);
assertNull
(
actual
);
}
}
...
@@ -240,6 +244,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
...
@@ -240,6 +244,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
}
}
}
}
@CacheDefaults
(
cacheResolverFactory
=
TestableCacheResolverFactory
.
class
,
@CacheDefaults
(
cacheResolverFactory
=
TestableCacheResolverFactory
.
class
,
cacheKeyGenerator
=
TestableCacheKeyGenerator
.
class
)
cacheKeyGenerator
=
TestableCacheKeyGenerator
.
class
)
static
class
CustomServiceWithDefaults
{
static
class
CustomServiceWithDefaults
{
...
@@ -255,6 +260,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
...
@@ -255,6 +260,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
}
}
}
}
static
class
InvalidCases
{
static
class
InvalidCases
{
@CacheRemove
@CacheRemove
...
...
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheInterceptorTests.java
浏览文件 @
e2518e0b
...
@@ -20,13 +20,13 @@ import java.lang.reflect.Method;
...
@@ -20,13 +20,13 @@ import java.lang.reflect.Method;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.beans.factory.support.StaticListableBeanFactory
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.interceptor.CacheOperationInvoker
;
import
org.springframework.cache.interceptor.CacheOperationInvoker
;
import
org.springframework.cache.interceptor.CacheResolver
;
import
org.springframework.cache.interceptor.CacheResolver
;
import
org.springframework.cache.interceptor.KeyGenerator
;
import
org.springframework.cache.interceptor.KeyGenerator
;
import
org.springframework.cache.interceptor.NamedCacheResolver
;
import
org.springframework.cache.interceptor.NamedCacheResolver
;
import
org.springframework.cache.jcache.AbstractJCacheTests
;
import
org.springframework.cache.jcache.AbstractJCacheTests
;
import
org.springframework.context.support.StaticApplicationContext
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.*;
...
@@ -108,11 +108,11 @@ public class JCacheInterceptorTests extends AbstractJCacheTests {
...
@@ -108,11 +108,11 @@ public class JCacheInterceptorTests extends AbstractJCacheTests {
CacheResolver
cacheResolver
,
CacheResolver
exceptionCacheResolver
,
KeyGenerator
keyGenerator
)
{
CacheResolver
cacheResolver
,
CacheResolver
exceptionCacheResolver
,
KeyGenerator
keyGenerator
)
{
DefaultJCacheOperationSource
source
=
new
DefaultJCacheOperationSource
();
DefaultJCacheOperationSource
source
=
new
DefaultJCacheOperationSource
();
source
.
setApplicationContext
(
new
StaticApplicationContext
());
source
.
setCacheManager
(
cacheManager
);
source
.
setCacheManager
(
cacheManager
);
source
.
setCacheResolver
(
cacheResolver
);
source
.
setCacheResolver
(
cacheResolver
);
source
.
setExceptionCacheResolver
(
exceptionCacheResolver
);
source
.
setExceptionCacheResolver
(
exceptionCacheResolver
);
source
.
setKeyGenerator
(
keyGenerator
);
source
.
setKeyGenerator
(
keyGenerator
);
source
.
setBeanFactory
(
new
StaticListableBeanFactory
());
source
.
afterPropertiesSet
();
source
.
afterPropertiesSet
();
source
.
afterSingletonsInstantiated
();
source
.
afterSingletonsInstantiated
();
return
source
;
return
source
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录