org.redkale.util

## 注释类型 ResourceListener

-     @Documented
       @Target(value=METHOD)
       @Retention(value=RUNTIME)
      public @interface ResourceListener

  @Resource资源被更新时的监听事件。本注解只能标记在方法参数为(String name, T newVal, T oldVal)上。 方法在资源被更新以后调用。

  >      public class Record {

  >         @Resource(name = "record.id")
  >         private int id;

  >         @Resource(name = "record.name")
  >         private String name;

  >         @ResourceListener
  >         private void changeResource(String name, Object newVal, Object oldVal) {
  >             System.out.println("@Resource = " + name + " 资源变更:  newVal = " + newVal + ", oldVal = " + oldVal);
  >         }

  >         public static void main(String[] args) throws Exception {
  >             ResourceFactory factory = ResourceFactory.root();
  >             factory.register("record.id", "2345");
  >             factory.register("record.name", "my old name");
  >             Record record = new Record();
  >             factory.inject(record);
  >             factory.register("record.name", "my new name");
  >        }

  >      }

  详情见: https://redkale.org