摘要: @ControllerAdvice public class DefaultAttributeController { // apply default value @ModelAttribute("newuser") public User getDefaultUser() { return ne 阅读全文
posted @ 2021-01-13 19:40 Zhentiw 阅读(121) 评论(0) 推荐(0)
摘要: Create file: // this apply to all the controllers @ControllerAdvice public class ApplicationExceptionHandler { @ExceptionHandler(ApplicationException. 阅读全文
posted @ 2021-01-13 19:36 Zhentiw 阅读(84) 评论(0) 推荐(0)
摘要: Controller: @Controller public class LoginController { private UserRepository userRepository; @PostMapping("/login") public String login(@ModelAttribu 阅读全文
posted @ 2021-01-13 01:18 Zhentiw 阅读(62) 评论(0) 推荐(0)
摘要: If you need to convert a deep nested object struture, you cannot just use @InitBinder, you need to build a custom convertor: Exp: conver city prop in 阅读全文
posted @ 2021-01-13 00:54 Zhentiw 阅读(114) 评论(0) 推荐(0)
摘要: For example, from the client, it send date as string to BE. But BE requires date to be a Date instead of String. Controller: .. @Autowired private Use 阅读全文
posted @ 2021-01-13 00:39 Zhentiw 阅读(95) 评论(0) 推荐(0)