阅读背景:

object is not an instance of declaring class

来源:互联网 

对象不是声明类的一个实例。

//获取adminLogService对象
        Object obj = null;
        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext()); 
        obj = context.getBean("adminLogService"); 
        
        if (obj != null) {
    	    try{
    	    	//使用反射执行adminLogService对象save方法
    	        Class<AdminLogService> adminLogService = (Class<AdminLogService>) obj.getClass();
    	        Method save = adminLogService.getDeclaredMethod("save", new Class[] { SystemLogEntity.class });
    	        save.invoke(adminLogService, new Object[] { systemLogEntity });
    	    }catch (Exception e){
    	        e.printStackTrace();
    	    }
        }
        //获取adminLogService对象
        O



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: