Skip to content

Commit 7a1687e

Browse files
committed
Fix Error message for unsupported Spring Security XSD versions
Closes gh-17153 Signed-off-by: Deep Dhamala <dhamaladeep2@gmail.com>
1 parent d8043dc commit 7a1687e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

config/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -94,9 +94,7 @@ public SecurityNamespaceHandler() {
9494
public BeanDefinition parse(Element element, ParserContext pc) {
9595
if (!namespaceMatchesVersion(element)) {
9696
pc.getReaderContext()
97-
.fatal("You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or "
98-
+ "spring-security-3.1.xsd schema or spring-security-3.2.xsd schema or spring-security-4.0.xsd schema "
99-
+ "with Spring Security 7.0. Please update your schema declarations to the 7.0 schema.",
97+
.fatal("You cannot use any XSD older than spring-security-7.0.xsd. Either change to spring-security.xsd or spring-security-7.0.xsd",
10098
element);
10199
}
102100
String name = pc.getDelegate().getLocalName(element);

config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -77,7 +77,8 @@ public void pre32SchemaAreNotSupported() {
7777
.isThrownBy(() -> new InMemoryXmlApplicationContext(
7878
"<user-service id='us'><user name='bob' password='bobspassword' authorities='ROLE_A' /></user-service>",
7979
"3.0.3", null))
80-
.withMessageContaining("You cannot use a spring-security-2.0.xsd");
80+
.withMessageContaining(
81+
"You cannot use any XSD older than spring-security-7.0.xsd. Either change to spring-security.xsd or spring-security-7.0.xsd");
8182
}
8283

8384
// SEC-1868

0 commit comments

Comments
 (0)