Gary Kephart Gary Kephart - 5 months ago 10
Java Question

Need Spring version# - only have spring.jar file

I've inherited an app that uses Spring. The original developers are not available. The Spring jar file is just "spring.jar", so there's no version# in the filename to help me. I'd like to download the Spring source corresponding to the jar file. The MANIFEST.MF file has "Spring-Version: 1.2" however that's not precise enough. I've looked at version 1.2.1 and 1.2.9 and it doesn't match up quite right. The key thing is that

org.springframework.web.servlet.view.AbstractCachingViewResolver
has a
prepareView
method which is called from
resolveViewName
and it does not seem to be in 1.2.1 or 1.2.9.

Is there any easy way to track down the right version?

Answer

This will do it:

import org.springframework.core.SpringVersion;

public class VersionChecker
{
    public static void main(String [] args)
    {
        System.out.println("version: " + SpringVersion.getVersion());
    }
}

Compile and run this with spring.jar in your CLASSPATH and it'll display the version for you. See the javadocs as well.

Comments