- Spring Boot 2.0 Cookbook(Second Edition)
- Alex Antonov
- 127字
- 2021-06-24 19:24:42
Configuring custom type formatters
Mostly because of its statefulness and lack of thread safety, since version 3, Spring has added a Formatter interface as a replacement for PropertyEditor. The formatters are intended to provide a similar functionality but in a completely thread-safe manner and focusing on a very specific task of parsing a String in an object type and converting an object to its String representation.
Let's suppose that for our application, we would like to have a formatter that would take the ISBN number of a book in a String form and convert it to a book entity object. This way, we can define the controller request methods with a Book argument when the request URL signature only contains an ISBN number or a database ID.
推薦閱讀
- PyTorch深度學習實戰:從新手小白到數據科學家
- Python絕技:運用Python成為頂級數據工程師
- 從零開始學Hadoop大數據分析(視頻教學版)
- Python數據分析入門:從數據獲取到可視化
- 使用GitOps實現Kubernetes的持續部署:模式、流程及工具
- Redis應用實例
- Learning Spring Boot
- Python廣告數據挖掘與分析實戰
- 圖解機器學習算法
- Lean Mobile App Development
- Sybase數據庫在UNIX、Windows上的實施和管理
- 基于Apache CXF構建SOA應用
- Oracle 12c云數據庫備份與恢復技術
- 金融商業算法建模:基于Python和SAS
- Hadoop集群與安全