Spring istypematch method: determines whether the JavaBean matches the specified type

isTypeMatch(String name,Class targetType)

Example

public static void main(String[] args){
  ApplicationContext context = new ClassPathXmlApplicationContext(
    "appContext.xml");  //加载appContext.xml文件
  boolean typeMatch = context.isTypeMatch("time",Date.class);  //判断获取类型是否是指定类型
  System.out.println("名称为time的JavaBean类型是否Date:"+typeMatch);
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>