Search code examples
javaspring-bootspring-mvcspring-webfluxsingle-page-application

Rest endpoint not working post Spring boot v3.2.1 migration


I am in the process of moving all my existing spring boot applications from version 2.7.4 to 3.2.1.

I've one weird observation. All the endpoints ending with / are not accessible from UI as well as from postman post migration

For example, this is an existing controller with one simple GET endpoint:

@RestController
@RequestMapping("/api/v1")
@RequiredArgsConstructor
public class TodosController {
    @GetMapping("/locations")
    public List<Integer> findAllCoordinates(){
        return List.of(10,15);
    }
}

now the GET /api/v1/locations/ doesn’t match anymore and is resulting in an HTTP 404 error.

However, GET /api/v1/locations works. The same problem is there with other endpoints as well. is it a bug in Spring Boot 3 or intentional behaviour has been changed?


Solution

  • This was considered a security vulnerability and has been the expected behaviour since Spring 6.0.0. See the issue.