{"record":{"id":"a6016da35958bbcc","repo":"dromara/Sa-Token","slug":"please-config-jboot-redis-cachename-host-in-yo","errorCode":null,"errorMessage":"Please config \"jboot.redis.{cacheName}.host\" in your jboot.properties.","messagePattern":"Please config \"jboot\\.redis\\.(.+?)\\.host\" in your jboot\\.properties\\.","errorType":"exception","errorClass":"JbootIllegalConfigException","httpStatus":null,"severity":"error","filePath":"sa-token-starter/sa-token-jboot-plugin/src/main/java/cn/dev33/satoken/jboot/SaTokenCacheDao.java","lineNumber":68,"sourceCode":"        JbootRedisConfig config = Jboot.config(JbootRedisConfig.class);\n        this.saRedisCache = new SaRedisCache(config);\n        this.serializer = new SaJdkSerializer();\n    }\n\n    /**\n     * 调用的Cache名称\n     *\n     * @param cacheName 使用的缓存配置名，默认为 default\n     */\n    public SaTokenCacheDao(String cacheName) {\n        SaRedisCache saCache = this.saRedisMap.get(cacheName);\n        if (saCache == null) {\n            synchronized (this) {\n                saCache = this.saRedisMap.get(cacheName);\n                if (saCache == null) {\n                    Map<String, JbootRedisConfig> configModels = ConfigUtil.getConfigModels(JbootRedisConfig.class);\n                    if (!configModels.containsKey(cacheName)) {\n                        throw new JbootIllegalConfigException(\"Please config \\\"jboot.redis.\" + cacheName + \".host\\\" in your jboot.properties.\");\n                    }\n\n                    JbootRedisConfig jbootRedisConfig = configModels.get(cacheName);\n                    saCache = new SaRedisCache(jbootRedisConfig);\n                    this.saRedisMap.put(cacheName, saCache);\n                }\n            }\n        }\n        this.saRedisCache = saCache;\n        this.serializer = new SaJdkSerializer();\n    }\n\n\n    @Override\n    public String get(String key) {\n        Jedis jedis = saRedisCache.getJedis();\n        try {\n            return jedis.get(key);","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/dromara/Sa-Token/blob/ac2c7f6e94a78573cf0bcb932dd8b04e68fad189/sa-token-starter/sa-token-jboot-plugin/src/main/java/cn/dev33/satoken/jboot/SaTokenCacheDao.java#L50-L86","documentation":"JbootIllegalConfigException from the SaTokenCacheDao constructor: the requested named Redis cache (cacheName, default 'default') has no corresponding jboot.redis.<cacheName>.* configuration block in jboot.properties. The DAO double-checks the map after the lock and fails fast because ConfigUtil returned no JbootRedisConfig for that name.","triggerScenarios":"Constructing new SaTokenCacheDao(\"mycache\") when jboot.properties lacks a jboot.redis.mycache.host entry; or the default cache name is changed without adding the matching config block.","commonSituations":"Renaming the sa-token cache in a Jboot app without adding the new Redis block; typo between the cacheName string in code and the properties key; copying a properties template that only defines some named caches.","solutions":["Add a config block for the exact name: jboot.redis.<cacheName>.host=... (plus port/password as needed)","Check the spelling/case of cacheName in code against the properties key — they must match exactly","Use the default name or ensure every named cache used by sa-token has its block"],"exampleFix":"# before (jboot.properties)\njboot.redis.default.host=127.0.0.1\n# code used new SaTokenCacheDao(\"sso-cache\")\n\n# after\njboot.redis.default.host=127.0.0.1\njboot.redis.sso-cache.host=127.0.0.1\njboot.redis.sso-cache.port=6379","handlingStrategy":"validation","validationCode":"Map<String, JbootRedisConfig> m = ConfigUtil.getConfigModels(JbootRedisConfig.class);\nif(!m.containsKey(cacheName)) {\n    // fail startup listing the missing jboot.redis.<cacheName> block\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Define every named redis cache block in jboot.properties before referencing it in code","Use constants for cache names so code and properties cannot drift"],"tags":["sa-token","jboot","redis","config"],"backgroundTag":null,"analyzedSha":"ac2c7f6e94a78573cf0bcb932dd8b04e68fad189","analyzedAt":"2026-08-14T14:36:10.271Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}