- 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.
推薦閱讀
- Building Computer Vision Projects with OpenCV 4 and C++
- Python絕技:運用Python成為頂級數據工程師
- 數據挖掘原理與實踐
- 大數據導論
- Live Longer with AI
- UDK iOS Game Development Beginner's Guide
- Spark核心技術與高級應用
- Mockito Cookbook
- Python數據分析:基于Plotly的動態可視化繪圖
- Oracle PL/SQL實例精解(原書第5版)
- 計算機組裝與維護(微課版)
- 區塊鏈應用開發指南:業務場景剖析與實戰
- 基于數據發布的隱私保護模型研究
- Python金融數據挖掘與分析實戰
- 算力芯片:高性能CPU/GPU/NPU微架構分析