spring-boot - logback-classic 1.2.9 版中的 ContextInitializer 不支持 Groovy 配置文件

标签 spring-boot groovy

更新到 spring-boot-starter-parent 2.6.2,由于以下错误,我的应用程序无法启动

文件 [file:logback.groovy] 的意外文件扩展名。应该是 .groovy 或 .xml。查看了提到的类的源代码,发现如下:

        final String urlString = url.toString();
        if (urlString.endsWith("xml")) {
            JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(loggerContext);
            configurator.doConfigure(url);
        } else {
            throw new LogbackException("Unexpected filename extension of file [" + url.toString() + "]. Should be either .groovy or .xml");
        }

所以看起来在最新版本中他们刚刚删除了 groovy 支持?除了回到excel配置之外,还有什么解决方法吗?谢谢

最佳答案

没有解决方法。出于安全原因,Groovy 支持在 1.2.9 中被删除。来自 release announcement :

Removed Groovy configuration support. As logging is so pervasive and configuration with Groovy is probably too powerful, this feature is unlikely to be reinstated for security reasons.

此删除以及其他一些更改是为了响应 CVE-2021-42550 而完成的.

关于spring-boot - logback-classic 1.2.9 版中的 ContextInitializer 不支持 Groovy 配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70755879/

相关文章:

使用 Java 9 模块 (JPMS) 时出现 java.lang.NoSuchMethodError

jquery - 卡塔隆 : Unable to click on object: Web element with id not found

hibernate - 查询以计算 Grails 中的 bool 属性值

grails - 导出DetachedCriteria对模型属性的默认查询

groovy - 如何将 String 转换为 GString 并替换 Groovy 中的占位符?

java - 如何舍入到最接近的 50 或 100?

java - 如何为spring data elasticsearch添加排序

java - 多对多映射 JsonMappingException : Infinite recursion (StackOverflowError)

java - 无法将 Spring Boot Admin Server 2 和 Spring Boot Admin Client 2 与 Spring Boot 2 集成在单个应用程序中

java - MapStruct 正在将所有 boolean 值映射为 false