Roy Truelove
Roy Truelove

Reputation: 22446

Determine Spring Version at runtime

Is there a way to determine my Spring Version at runtime? eg

log.info("I'm running spring version '{}'", SpringWhatever.getVersion());

Debug-level logging is not showing me anything.

Full background is that I can compile but am getting java.lang.NoSuchMethodError: org.springframework.context.support.PropertySourcesPlaceholderConfigurer.getAppliedPropertySources() at runtime.

Upvotes: 14

Views: 10306

Answers (2)

Krzysztof Tomaszewski
Krzysztof Tomaszewski

Reputation: 1144

Please note that there may be couple of versions related to Spring ecosystem, like:

  • Spring Framework version (covered by answer by Roy in 2015)
  • Spring Boot version - similar: SpringBootVersion.getVersion()
  • Spring Cloud release train - ?

Upvotes: 2

Roy Truelove
Roy Truelove

Reputation: 22446

Yes, its

org.springframework.core.SpringVersion.getVersion()

Upvotes: 26

Related Questions