We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Affects: <Spring Framework 5>
If we have use @GetMapping ("hello") or @GetMapping("/hello") both works seamlessly .Example: -
@GetMapping ("hello")
@GetMapping("/hello")
@GetMapping("user/{userId}") public Optional<User> getUser(@PathVariable("userId") Long id) { logger.info(" User id {}", id); return userRepository.findById(id); }
With Reactive Routes it is not same, it accepts only with prefix "/" which is counter intuitive. Example : -
@Bean public RouterFunction userRoutes() { return RouterFunctions.route( RequestPredicates.GET("/users"), userHandler::getAll) .andRoute(RequestPredicates.POST("/user"), userHandler::add) .andRoute(RequestPredicates.PUT("/user"), userHandler::update) .andRoute(RequestPredicates.GET("/user/{id}"), userHandler::get) .andRoute(RequestPredicates.DELETE("/user/{id}"), userHandler::delete); }
It might not be a bug but certainly can be an enhancement.
The text was updated successfully, but these errors were encountered:
Can you reproduce this? Looking through the source, it seems the missing / is accounted for in the 5.2.0 release tag. (https://github.com/spring-projects/spring-framework/blob/v5.2.0.RELEASE/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java)
public static RequestPredicate POST(String pattern) { return method(HttpMethod.POST).and(path(pattern)); } // and public static RequestPredicate path(String pattern) { Assert.notNull(pattern, "'pattern' must not be null"); if (!pattern.isEmpty() && !pattern.startsWith("/")) { pattern = "/" + pattern; } return pathPredicates(DEFAULT_PATTERN_PARSER).apply(pattern); }
Sorry, something went wrong.
Resolving as duplicate of #22795.
No branches or pull requests
Affects: <Spring Framework 5>
If we have use
@GetMapping ("hello")
or@GetMapping("/hello")
both works seamlessly .Example: -With Reactive Routes it is not same, it accepts only with prefix "/" which is counter intuitive. Example : -
It might not be a bug but certainly can be an enhancement.
The text was updated successfully, but these errors were encountered: