简体   繁体   中英

Domain types in Spring MVC controller method signatures not working

After updating Spring Boot 2.3.0.RELEASE to 2.3.1.RELEASE, domian class conversion stopped working inside controller methods.

Here is the reference controller, which was working perfectly fine till Spring Boot 2.3.0.RELEASE

@Controller 
@RequestMapping("/users")
class UserController {

  @RequestMapping("/{id}")
  String showUserForm(@PathVariable("id") User user, Model model) {

    model.addAttribute("user", user);
    return "userForm";
  }
}

in 2.3.1.RELEASE, I get the below error, when i make the following request

GET /users/<userid>

2020-06-17 13:07:12.780 WARN 574637 --- [ XNIO-1 task-3].wsmsDefaultHandlerExceptionResolver: Resolved [org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'com.xxx.User'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'com.xxx.User': no matching editors or conversion strategy found]

you can update to Spring Boot 2.3.2 which was released "yesterday" . This should fix your issue.

It contains the update to Spring Data Neumann-SR2 . This version is listed a fix version for your related bug ticket .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM