Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
c67aedd8
Commit
c67aedd8
authored
Jun 04, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Retrieve javax.cache.CacheManager using Bean ClassLoader"
Closes gh-13338
parent
76b9d0d2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
JCacheCacheConfiguration.java
...rk/boot/autoconfigure/cache/JCacheCacheConfiguration.java
+6
-6
CacheAutoConfigurationTests.java
...boot/autoconfigure/cache/CacheAutoConfigurationTests.java
+10
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java
View file @
c67aedd8
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -88,6 +88,11 @@ class JCacheCacheConfiguration implements BeanClassLoaderAware {
this
.
cachePropertiesCustomizers
=
cachePropertiesCustomizers
.
getIfAvailable
();
}
@Override
public
void
setBeanClassLoader
(
ClassLoader
classLoader
)
{
this
.
beanClassLoader
=
classLoader
;
}
@Bean
public
JCacheCacheManager
cacheManager
(
CacheManager
jCacheCacheManager
)
{
JCacheCacheManager
cacheManager
=
new
JCacheCacheManager
(
jCacheCacheManager
);
...
...
@@ -154,11 +159,6 @@ class JCacheCacheConfiguration implements BeanClassLoaderAware {
}
}
@Override
public
void
setBeanClassLoader
(
ClassLoader
classLoader
)
{
this
.
beanClassLoader
=
classLoader
;
}
/**
* Determine if JCache is available. This either kicks in if a provider is available
* as defined per {@link JCacheProviderAvailableCondition} or if a
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java
View file @
c67aedd8
...
...
@@ -374,6 +374,16 @@ public class CacheAutoConfigurationTests {
"spring.cache.jcache.config="
+
configLocation
);
}
@Test
public
void
jCacheCacheUseBeanClassLoader
()
{
String
cachingProviderFqn
=
MockCachingProvider
.
class
.
getName
();
load
(
DefaultCacheConfiguration
.
class
,
"spring.cache.type=jcache"
,
"spring.cache.jcache.provider="
+
cachingProviderFqn
);
JCacheCacheManager
cacheManager
=
validateCacheManager
(
JCacheCacheManager
.
class
);
assertThat
(
cacheManager
.
getCacheManager
().
getClassLoader
())
.
isEqualTo
(
this
.
context
.
getClassLoader
());
}
@Test
public
void
ehcacheCacheWithCaches
()
{
load
(
DefaultCacheConfiguration
.
class
,
"spring.cache.type=ehcache"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment