spring自定义属性编辑器

spring自定义属性编辑器

属性编辑器用来解析bean的配置文件中的属性标签,spring的BeanWrapperImpl默认会注册CustomCollectionEditor(集合)、CustomMapEditor(Map)、CurrencyEditor(货币)、ByteArrayPropertyEditor等,可以使用CustomEditorConfigurer 来注册属性编辑器,CustomEditorConfigurer实现了BeanFactoryPostProcessor接口,由spring容器自动检测并执行

步骤

  • 创建一个实现 PropertyEditorRegistrar 接口的类,重写 registerCustomEditors方法,负责向spring容器注册属性编辑器
  • PropertyEditorRegistrar实现类作为bean进行注册
  • 配置 CustomEditorConfigurer 这个bean,并写入属性 propertyEditorRegistrars

https://zhhll.icu/2021/框架/spring/基础/17.spring自定义属性编辑器/

本文由mdnice多平台发布

相关推荐
_codemonster1 分钟前
系统分析师系列目录
java·网络·数据库
带刺的坐椅16 分钟前
Spring AI 2.0 GA 倒计时:先别急,来看看 Java AI 框架的另一条路
java·spring·ai·llm·agent·solon
TE-茶叶蛋38 分钟前
Java 8 引入的Stream API-stream()
java·windows·python
Stream_Silver40 分钟前
【 libusb4java实战:跨平台USB设备通信完全指南】
java·笔记·嵌入式硬件·microsoft
极光代码工作室42 分钟前
基于SpringBoot的宿舍管理系统
java·springboot·web开发·后端开发
Ting-yu1 小时前
SpringCloud快速入门(8)---- OpenFeign(远程调用)
java·spring·spring cloud
两年半的个人练习生^_^1 小时前
什么是内存泄漏?什么是内存溢出?
java·开发语言
曦夜日长1 小时前
C++ STL容器string(二):删除与插入、数据查找、自定义输入
java·开发语言·c++
赏金术士1 小时前
Kotlin 协程底层原理(Continuation)详解
java·开发语言·kotlin
手揽回忆怎么睡1 小时前
springboot3使用ProGuard混淆jar
java·jar