这是行不通的,因为Spring的JAXB
marshaller(Jaxb2Marshaller)期望类上的@XmlRootElement能够编组。因此,可以通过添加一个中间类来表示列表来解决它:
@XmlRootElement(name = "files")public class FileManagementList { @XmlElement(name = "file") private List<FileManagement> files; public FileManagementList() { this(Collections.<FileManagement>emptyList()); } public FileManagementList(List<FileManagement> files) { this.files = files; }}


