Spring Boot 3 + Spring 6
in developCo-De with 0 comment

Spring Boot 3 + Spring 6

in developCo-De with 0 comment

In Spring 6 MVC, trailing slashes in URLs are not automatically handled

  /*Only handle localhost:8080/hello, access /hello/ will give 404 */
  @GetMapping("/hello")
  public String hello() {
    return "hello";
  }
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
   @Override
   public void configurePathMatch(PathMatchConfigurer configurer) {
     configurer.setUseTrailingSlashMatch(true);
   }
}
Comments are closed.