|
@@ -20,6 +20,9 @@ import org.apache.commons.logging.LogFactory;
|
|
|
|
|
|
import org.springframework.core.SpringVersion;
|
|
import org.springframework.core.SpringVersion;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.Properties;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Internal class used for checking version compatibility in a deployed application.
|
|
* Internal class used for checking version compatibility in a deployed application.
|
|
*
|
|
*
|
|
@@ -40,7 +43,7 @@ public class SpringSecurityCoreVersion {
|
|
*/
|
|
*/
|
|
public static final long SERIAL_VERSION_UID = 500L;
|
|
public static final long SERIAL_VERSION_UID = 500L;
|
|
|
|
|
|
- static final String MIN_SPRING_VERSION = "5.0.5.RELEASE";
|
|
|
|
|
|
+ static final String MIN_SPRING_VERSION = getSpringVersion();
|
|
|
|
|
|
static {
|
|
static {
|
|
performVersionChecks();
|
|
performVersionChecks();
|
|
@@ -64,6 +67,9 @@ public class SpringSecurityCoreVersion {
|
|
* @param minSpringVersion
|
|
* @param minSpringVersion
|
|
*/
|
|
*/
|
|
private static void performVersionChecks(String minSpringVersion) {
|
|
private static void performVersionChecks(String minSpringVersion) {
|
|
|
|
+ if (minSpringVersion == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
// Check Spring Compatibility
|
|
// Check Spring Compatibility
|
|
String springVersion = SpringVersion.getVersion();
|
|
String springVersion = SpringVersion.getVersion();
|
|
String version = getVersion();
|
|
String version = getVersion();
|
|
@@ -95,4 +101,18 @@ public class SpringSecurityCoreVersion {
|
|
}
|
|
}
|
|
return Boolean.getBoolean(DISABLE_CHECKS);
|
|
return Boolean.getBoolean(DISABLE_CHECKS);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Loads the spring version or null if it cannot be found.
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private static String getSpringVersion() {
|
|
|
|
+ Properties properties = new Properties();
|
|
|
|
+ try {
|
|
|
|
+ properties.load(SpringSecurityCoreVersion.class.getClassLoader().getResourceAsStream("META-INF/spring-security.versions"));
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ return properties.getProperty("org.springframework:spring-core");
|
|
|
|
+ }
|
|
}
|
|
}
|