String[] param = new String[]{"2","2"}; Method getByIdsMethod = outerEntityApi.getClass().getMethod("getByIds", String[].class); System.out.println("123:"+ JSONObject.toJSONString(map.get(multiKey).toArray(new String[0]))); ResponseEntity<List<BaseDto>> result = (ResponseEntity<List<BaseDto>>) getByIdsMethod.invoke(outerEntityApi, (Object)param);
getMethod() 方法第二个参数直接写String[].class 就可以
但是在 method.invoke() 方法的第二个参数要 使用 (Object)arr 进行强制的类型转换!