class path resource [templates/] cannot be resolved to absolute file path because it does not reside

报错:
在运行springcloud代码的时候报错,但是不影响正常启动
分析:
经过谷歌和百度发现FreeMarkerConfigurationFactory中存在以下方法:

protected TemplateLoader getTemplateLoaderForPath(String templateLoaderPath) {
        if(this.isPreferFileSystemAccess()) {
            try {
                Resource ex = this.getResourceLoader().getResource(templateLoaderPath);
                File file = ex.getFile();
                if(this.logger.isDebugEnabled()) {
                    this.logger.debug("Template loader path [" + ex + "] resolved to file path [" + file.getAbsolutePath() + "]");
                }

                return new FileTemplateLoader(file);
            } catch (IOException var4) {
                if(this.logger.isDebugEnabled()) {
                    this.logger.debug("Cannot resolve template loader path [" + templateLoaderPath + "] to [java.io.File]: using SpringTemplateLoader as fallback", var4);
                }

                return new SpringTemplateLoader(this.getResourceLoader(), templateLoaderPath);
            }
        } else {
            this.logger.debug("File system access not preferred: using SpringTemplateLoader");
            return new SpringTemplateLoader(this.getResourceLoader(), templateLoaderPath);
        }
    }

解决办法:
class path resource [templates/] cannot be resolved to absolute file path because it does not reside_第1张图片
说白了呢就是把spring的日志级别换成INFO即可
在这里插入图片描述
友情提示记得找到自己项目日志的配置路径哦~

你可能感兴趣的:(class path resource [templates/] cannot be resolved to absolute file path because it does not reside)