Skip to content

Commit ea665d7

Browse files
committed
Polish "Fix reference to configurePathMatching in code sample"
See gh-33277
1 parent 7a2fc2f commit ea665d7

File tree

4 files changed

+71
-34
lines changed

4 files changed

+71
-34
lines changed

framework-docs/framework-docs.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dependencies {
4646
api(project(":spring-jdbc"))
4747
api(project(":spring-jms"))
4848
api(project(":spring-web"))
49+
api(project(":spring-webflux"))
4950

5051
api("com.oracle.database.jdbc:ojdbc11")
5152
api("jakarta.jms:jakarta.jms-api")

framework-docs/modules/ROOT/pages/web/webflux/config.adoc

+1-34
Original file line numberDiff line numberDiff line change
@@ -688,40 +688,7 @@ You can customize options related to path matching. For details on the individua
688688
{spring-framework-api}/web/reactive/config/PathMatchConfigurer.html[`PathMatchConfigurer`] javadoc.
689689
The following example shows how to use `PathMatchConfigurer`:
690690

691-
[tabs]
692-
======
693-
Java::
694-
+
695-
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
696-
----
697-
@Configuration
698-
@EnableWebFlux
699-
public class WebConfig implements WebFluxConfigurer {
700-
701-
@Override
702-
public void configurePathMatching(PathMatchConfigurer configurer) {
703-
configurer.addPathPrefix(
704-
"/api", HandlerTypePredicate.forAnnotation(RestController.class));
705-
}
706-
}
707-
----
708-
709-
Kotlin::
710-
+
711-
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
712-
----
713-
@Configuration
714-
@EnableWebFlux
715-
class WebConfig : WebFluxConfigurer {
716-
717-
@Override
718-
fun configurePathMatching(configurer: PathMatchConfigurer) {
719-
configurer.addPathPrefix(
720-
"/api", HandlerTypePredicate.forAnnotation(RestController::class.java))
721-
}
722-
}
723-
----
724-
======
691+
include-code::./WebConfig[]
725692

726693
[TIP]
727694
====
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2002-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.docs.web.webflux.webfluxconfigpathmatching;
18+
19+
import org.springframework.context.annotation.Configuration;
20+
import org.springframework.web.bind.annotation.RestController;
21+
import org.springframework.web.method.HandlerTypePredicate;
22+
import org.springframework.web.reactive.config.EnableWebFlux;
23+
import org.springframework.web.reactive.config.PathMatchConfigurer;
24+
import org.springframework.web.reactive.config.WebFluxConfigurer;
25+
26+
@Configuration
27+
@EnableWebFlux
28+
public class WebConfig implements WebFluxConfigurer {
29+
30+
@Override
31+
public void configurePathMatching(PathMatchConfigurer configurer) {
32+
configurer.addPathPrefix(
33+
"/api", HandlerTypePredicate.forAnnotation(RestController.class));
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2002-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.docs.web.webflux.webfluxconfigpathmatching
18+
19+
import org.springframework.context.annotation.Configuration
20+
import org.springframework.web.bind.annotation.RestController
21+
import org.springframework.web.method.HandlerTypePredicate
22+
import org.springframework.web.reactive.config.EnableWebFlux
23+
import org.springframework.web.reactive.config.PathMatchConfigurer
24+
import org.springframework.web.reactive.config.WebFluxConfigurer
25+
26+
@Configuration
27+
@EnableWebFlux
28+
class WebConfig : WebFluxConfigurer {
29+
30+
override fun configurePathMatching(configurer: PathMatchConfigurer) {
31+
configurer.addPathPrefix(
32+
"/api", HandlerTypePredicate.forAnnotation(RestController::class.java))
33+
}
34+
}

0 commit comments

Comments
 (0)