A component required a bean named 'cacheManager' that could not be found.
*************************** APPLICATION FAILED TO START *************************** Description: A component required a bean named 'cacheManager' that could not be found. Action: Consider defining a bean named 'cacheManager' in your configuration.
在使用springboot集成hazelcast时候,启动时候报错。
需要在启动类中加入一个bean
@Bean public CacheManager cacheManager() { return new HazelcastCacheManager(); }
这样启动后,可以进行正常启动
或者添加配置文件为:
@Configuration public class HazelcaseConfig { /** * @description 3.创建Hazelcase的Config类 */ @Bean public Config getConfig() { Config hazelcaseConfig = new Config(); // MapConfig mapConfig = new MapConfig(); // mapConfig.setName("myMap");// 设置当前的mapConfig的名称 hazelcaseConfig.setInstanceName("test-hazelcase");// 设置当前创建的实例的名称 // .addMapConfig(mapConfig);//添加当前的map return hazelcaseConfig; } }
可以进行实现
本文来自博客园,作者:King-DA,转载请注明原文链接:https://www.cnblogs.com/qingmuchuanqi48/p/12319393.html