代码:
@Method def exportApplication(Map params, User user){ String[] ids = params.ids if (ids == null || ids.size()<1){ return null } String fileName = params.fileName String tenantId = TenantUtils.getUserTenantId(user) return componentTransfer(user).exportApplication(ids as String[], fileName, tenantId) }
错误:Caused by: java.lang.IllegalAccessException: Class com.mw.converter.JsonConverter can not access a member of class sun.nio.ch.FileChannelImpl$1 with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
原因:json 类型返回值的 groovy 方法不要返回复杂的java对象
解决方法:修改返回值类型@Method('.bin')