If a cache is created directory on the wrapped Ehcache CacheManager, the JSR107 won' see it. See this code:
@Test
public void test() {
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
org.ehcache.CacheManager ecm = cacheManager.unwrap(org.ehcache.CacheManager.class);
ecm.createCache("foo", CacheConfigurationBuilder.newCacheConfigurationBuilder(Integer.class, String.class, ResourcePoolsBuilder.heap(1)));
Cache<Integer, String> cache = cacheManager.getCache("foo", Integer.class, String.class);
assertThat(cache).isNotNull(); // fails
}
However, add a cacheManager.getCacheNames() before calling getCache repairs it since it causes a cache refresh.
I think it should work or at least be coherent.