This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Scope: mặc định trong Spring, hầu hết scope phổ biến cho các autodetected components là singleton (singleton: Với mỗi bean, Spring IoC Container chỉ tạo duy nhất một đối tượng), để thay đổi phạm vi ta sử dụng @Scope annotation).
@RequestMapping: dùng để ánh xạ tới các URL lên toàn bộ một class hay một phương thức xử lý riêng. Thông thường dùng để ánh xạ một request path (hoặc path pattern)
tới một controller.
@InitBinder: dùng để đánh dấu một phương thức có tùy biến các ràng buộc dữ liệu. @SessionAttribute: Chỉ định một modelAttribute sẽ được lưu trong session.
Spring Security Annotation
@PreAuthorize: được dùng để cho phép hoặc từ chối sử dụng một phương thức. Trong ví dụ dưới đây, chỉ những đối tượng user có quyền Admin mới có thể xóa được một đối tượng contact: