上一页 1 ··· 161 162 163 164 165 166 167 168 169 ··· 498 下一页
摘要: Interceptor jump in before controller. So request may not reach controller if Pre-process is not ok. Demo: package com.test.hplus.interceptors; import 阅读全文
posted @ 2021-01-15 19:56 Zhentiw 阅读(114) 评论(0) 推荐(0)
摘要: In this lesson, you will learn how to extend a class's functionality through typescript decorators. Decorators provide a way to add both annotations a 阅读全文
posted @ 2021-01-14 04:21 Zhentiw 阅读(59) 评论(0) 推荐(0)
摘要: @ControllerAdvice public class DefaultAttributeController { // apply default value @ModelAttribute("newuser") public User getDefaultUser() { return ne 阅读全文
posted @ 2021-01-13 19:40 Zhentiw 阅读(133) 评论(0) 推荐(0)
摘要: Create file: // this apply to all the controllers @ControllerAdvice public class ApplicationExceptionHandler { @ExceptionHandler(ApplicationException. 阅读全文
posted @ 2021-01-13 19:36 Zhentiw 阅读(98) 评论(0) 推荐(0)
摘要: Controller: @Controller public class LoginController { private UserRepository userRepository; @PostMapping("/login") public String login(@ModelAttribu 阅读全文
posted @ 2021-01-13 01:18 Zhentiw 阅读(72) 评论(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 阅读(125) 评论(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 阅读(108) 评论(0) 推荐(0)
摘要: User entity: import javax.validation.constraints.*; @Entity public class User { @Id private int id; @Size(min = 6, message = "Username cannot be less 阅读全文
posted @ 2021-01-12 20:54 Zhentiw 阅读(88) 评论(0) 推荐(0)
摘要: @Repository public interface ProductRepository extends CrudRepository<Product, Integer> { @Query("select p from Product p where p.name like %:name%") 阅读全文
posted @ 2021-01-12 15:49 Zhentiw 阅读(158) 评论(0) 推荐(0)
摘要: Set<Book> lib = ... lib.stream() .flatMap(book -> book.getWords().stream()) .distinct() .forEach(System.out::println); 阅读全文
posted @ 2021-01-07 03:22 Zhentiw 阅读(132) 评论(0) 推荐(0)
上一页 1 ··· 161 162 163 164 165 166 167 168 169 ··· 498 下一页