Grails [X]中的[getAssociatedToEntities]操作接受类型为[java.util.List]的参数 上下文

Grails [X]中的[getAssociatedToEntities]操作接受类型为[java.util.List]的参数 上下文,grails,spring-security,spring-security-rest,Grails,Spring Security,Spring Security Rest,我在Grails 2.4.4中有一个项目使用了,我得到了这个警告: Warning | The [getAssociatedToEntities] action in [security.UserController] accepts a parameter of type [java.util.List]. Interface types and abstract class types are not supported as command objects. This paramete

我在Grails 2.4.4中有一个项目使用了,我得到了这个警告:

Warning |
The [getAssociatedToEntities] action in [security.UserController] accepts a parameter of type [java.util.List].  Interface types and abstract class types are not supported as command objects.  This parameter will be ignored.

       @Secured("hasAnyRole('READ__USER', 'READ__PROFILE')")
       ^
这是代码

构建配置

UserController(警告来自的代码!)

@Secured(“hasAnyRole('READ\u USER'、'READ\u PROFILE'))
def getAssociatedToEntities(列表e,SearchCommand cmd){
//代码省略
}
问:我怎样才能摆脱这个警告


提前谢谢

将其包装在列表中:
@Secured(“hasAnyRole(['READ\u USER','READ\u PROFILE'])”)

是一个不能用作安全接口的接口,请尝试以下操作:

创建包含列表的命令对象

import grails.validation.Validateable

@Validateable
class SearchListCommand extends SearchCommand {
  List values
}
并在
getAssociatedToEntities
操作中将列表的声明替换为命令对象

def getAssociatedToEntities(SearchListCommand listCommand) { 
     //code omitted...
}
import grails.validation.Validateable

@Validateable
class SearchListCommand extends SearchCommand {
  List values
}
def getAssociatedToEntities(SearchListCommand listCommand) { 
     //code omitted...
}