1
1
/*
2
- * Copyright 2009-2020 the original author or authors.
2
+ * Copyright 2009-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
17
17
package org .springframework .security .config .util ;
18
18
19
- import java .io .IOException ;
20
- import java .io .InputStream ;
21
- import java .util .Properties ;
22
-
23
19
import org .springframework .beans .factory .support .DefaultListableBeanFactory ;
24
20
import org .springframework .context .ApplicationContext ;
25
21
import org .springframework .context .support .AbstractXmlApplicationContext ;
26
22
import org .springframework .core .io .Resource ;
27
- import org .springframework .security .core .SpringSecurityCoreVersion ;
28
23
import org .springframework .security .util .InMemoryResource ;
29
24
30
25
/**
34
29
*/
35
30
public class InMemoryXmlApplicationContext extends AbstractXmlApplicationContext {
36
31
37
- private static String getCurrentXSDVersionFromSpringSchemas () {
38
- Properties properties = new Properties ();
39
- try (InputStream is = SpringSecurityCoreVersion .class .getClassLoader ()
40
- .getResourceAsStream ("META-INF/spring.schemas" )) {
41
- properties .load (is );
42
- }
43
- catch (IOException ex ) {
44
- throw new RuntimeException ("Could not read 'META-INF/spring.schemas'" , ex );
45
- }
46
-
47
- String inPackageLocation = properties
48
- .getProperty ("https://www.springframework.org/schema/security/spring-security.xsd" );
49
- String [] parts = inPackageLocation .split ("-" );
50
- String currentXSD = parts [parts .length - 1 ];
51
- String currentVersion = currentXSD .replace (".xsd" , "" );
52
- return currentVersion ;
53
- }
54
-
55
32
static final String BEANS_OPENING = "<b:beans xmlns='http://www.springframework.org/schema/security'\n "
56
33
+ " xmlns:context='http://www.springframework.org/schema/context'\n "
57
34
+ " xmlns:b='http://www.springframework.org/schema/beans'\n "
@@ -66,7 +43,7 @@ private static String getCurrentXSDVersionFromSpringSchemas() {
66
43
+ "http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context-2.5.xsd\n "
67
44
+ "http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security-" ;
68
45
static final String BEANS_CLOSE = "</b:beans>\n " ;
69
- static final String SPRING_SECURITY_VERSION = getCurrentXSDVersionFromSpringSchemas ();
46
+ static final String SPRING_SECURITY_VERSION = SpringSecurityVersions . getCurrentXsdVersionFromSpringSchemas ();
70
47
71
48
Resource inMemoryXml ;
72
49
0 commit comments