Skip to content

Commit 7960d28

Browse files
committed
Add Migration Steps for PathMatcher Usage
Issue gh-17509
1 parent 4b15b2b commit 7960d28

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

docs/modules/ROOT/pages/migration-7/messaging.adoc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,49 @@ Xml::
3838
======
3939

4040
This will tell the Spring Security DSL to use `PathPatternMessageMatcher` for all message matchers that it constructs.
41+
42+
Use of `PathMatcher` is no longer supported in 7.
43+
If you are using `PathMatcher` to change the path separator or to change case sensitivity for message matching, you can configure the `PathPatternParser` to do this instead like so:
44+
45+
[tabs]
46+
======
47+
Java::
48+
+
49+
[source,java,role="primary"]
50+
----
51+
@Bean
52+
PathPatternMessageMatcherBuilderFactoryBean messageMatcherBuilder() {
53+
PathPatternParser pathPatternParser = new PathPatternParser();
54+
pathPatternParser.setCaseSensitive(false);
55+
// use . as path separator
56+
pathPatternParser.setPathOptions(PathContainer.Options.MESSAGE_ROUTE);
57+
return new PathPatternMessageMatcherBuilderFactoryBean(pathPatternParser);
58+
}
59+
----
60+
61+
Kotlin::
62+
+
63+
[source,kotlin,role="secondary"]
64+
----
65+
@Bean
66+
fun messageMatcherBuilder(): PathPatternMessageMatcherBuilderFactoryBean {
67+
val pathPatternParser = PathPatternParser()
68+
pathPatternParser.setCaseSensitive(false)
69+
// use . as path separator
70+
pathPatternParser.setPathOptions(PathContainer.Options.MESSAGE_ROUTE)
71+
return PathPatternMessageMatcherBuilderFactoryBean(pathPatternParser)
72+
}
73+
----
74+
75+
Xml::
76+
+
77+
[source,xml,role="secondary"]
78+
----
79+
<b:bean class="org.springframework.web.util.pattern.PathPatternParser">
80+
<b:property name="caseSensitive" value="false"/>
81+
<!-- use . as path separator -->
82+
<b:property name="pathOptions" value="#{T(org.springframework.http.server.PathContainer.Options).MESSAGE_ROUTE"/>
83+
</b:bean>
84+
<b:bean class="org.springframework.security.config.web.messaging.PathPatternMessageMatcherBuilderFactoryBean"/>
85+
----
86+
======

0 commit comments

Comments
 (0)