更新到 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/