在运行时确定Spring版本

Roy*_*ove 7 spring

有没有办法在运行时确定我的Spring版本?例如

log.info("I'm running spring version '{}'", SpringWhatever.getVersion());
Run Code Online (Sandbox Code Playgroud)

调试级别的日志记录没有显示任何内容.

完整的背景是我可以编译,但我得到了 java.lang.NoSuchMethodError: org.springframework.context.support.PropertySourcesPlaceholderConfigurer.getAppliedPropertySources()在运行.

Roy*_*ove 14

是的,它就是

org.springframework.core.SpringVersion.getVersion()
Run Code Online (Sandbox Code Playgroud)