/*
 * Copyright 2012-2015 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.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.actuate.autoconfigure;

import javax.cache.Caching;

import net.sf.ehcache.Ehcache;

import org.springframework.boot.actuate.cache.CacheStatistics;
import org.springframework.boot.actuate.cache.CacheStatisticsProvider;
import org.springframework.boot.actuate.cache.ConcurrentMapCacheStatisticsProvider;
import org.springframework.boot.actuate.cache.DefaultCacheStatistics;
import org.springframework.boot.actuate.cache.EhCacheStatisticsProvider;
import org.springframework.boot.actuate.cache.GuavaCacheStatisticsProvider;
import org.springframework.boot.actuate.cache.HazelcastCacheStatisticsProvider;
import org.springframework.boot.actuate.cache.JCacheStatisticsProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.jcache.JCacheCache;
import org.springframework.cache.support.NoOpCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.hazelcast.core.IMap;

/**
 * {@link EnableAutoConfiguration Auto-configuration} for {@link CacheStatisticsProvider}
 * beans.
 *
 * @author Stephane Nicoll
 * @author Phillip Webb
 * @since 1.3.0
 */
@Configuration
@AutoConfigureAfter(CacheAutoConfiguration.class)
@ConditionalOnBean(CacheManager.class)
public class CacheStatisticsAutoConfiguration {

	@Configuration
	@ConditionalOnClass({ Caching.class, JCacheCache.class })
	static class JCacheCacheStatisticsProviderConfiguration {

		@Bean
		public JCacheStatisticsProvider jCacheStatisticsProvider() {
			return new JCacheStatisticsProvider();
		}

	}

	@Configuration
	@ConditionalOnClass(Ehcache.class)
	static class EhCacheCacheStatisticsProviderConfiguration {

		@Bean
		public EhCacheStatisticsProvider ehCacheCacheStatisticsProvider() {
			return new EhCacheStatisticsProvider();
		}

	}

	@Configuration
	@ConditionalOnClass(IMap.class)
	static class HazelcastCacheStatisticsConfiguration {

		@Bean
		public HazelcastCacheStatisticsProvider hazelcastCacheStatisticsProvider() {
			return new HazelcastCacheStatisticsProvider();
		}
	}

	@Configuration
	@ConditionalOnClass(com.google.common.cache.Cache.class)
	static class GuavaCacheStatisticsConfiguration {

		@Bean
		public GuavaCacheStatisticsProvider guavaCacheStatisticsProvider() {
			return new GuavaCacheStatisticsProvider();
		}

	}

	@Configuration
	@ConditionalOnClass(ConcurrentMapCache.class)
	static class ConcurrentMapCacheStatisticsConfiguration {

		@Bean
		public ConcurrentMapCacheStatisticsProvider concurrentMapCacheStatisticsProvider() {
			return new ConcurrentMapCacheStatisticsProvider();
		}

	}

	@Configuration
	@ConditionalOnClass(NoOpCacheManager.class)
	static class NoOpCacheStatisticsConfiguration {

		private static final CacheStatistics NO_OP_STATS = new DefaultCacheStatistics();

		@Bean
		public CacheStatisticsProvider<Cache> noOpCacheStatisticsProvider() {
			return new CacheStatisticsProvider<Cache>() {
				@Override
				public CacheStatistics getCacheStatistics(CacheManager cacheManager,
						Cache cache) {
					if (cacheManager instanceof NoOpCacheManager) {
						return NO_OP_STATS;
					}
					return null;
				}
			};
		}

	}

}

@@ -701,16 +701,98 @@
 ching;%0A%0A
+import com.hazelcast.core.IMap;%0Aimport com.hazelcast.spring.cache.HazelcastCache;%0A
 import n
@@ -2149,41 +2149,8 @@
 n;%0A%0A
-import com.hazelcast.core.IMap;%0A%0A
 /**%0A
@@ -3013,16 +3013,18 @@
 OnClass(
+%7B 
 IMap.cla
@@ -3021,24 +3021,48 @@
 %7B IMap.class
+, HazelcastCache.class%7D 
 )%0A%09static cl

Fix Hazelcast cache statistics condition