10 2021 档案

ApplicationContext在非Service类中调用Spring的Serivce类
摘要:背景 有时我们需要在一些不属于Spring的类中,去调用Spring的Service类的方法。 比如,在Util类,或者main()方法中,去调用Service类的方法。 这时,可以使用 ApplicationContextAware接口 和 ApplicationContext接口 . Appli 阅读全文

posted @ 2021-10-25 11:57 乐之者v 阅读(221) 评论(0) 推荐(0)

PropertyDescriptor动态反射setter和getter设置对象属性
摘要:PropertyDescriptor 我们在开发的过程中,有时会需要动态地设置属性,也就是动态getter、 setter。 使用传统的反射 Method、Field等类去处理,需要对方法名进行大量拼接,比较麻烦。 可以使用 PropertyDescriptor. 常用方法: 构造方法: Prope 阅读全文

posted @ 2021-10-19 19:41 乐之者v 阅读(945) 评论(0) 推荐(0)

导航