我有第一个元素为null的列表.Intellij调试器将有效大小编号显示为:5,但它仅显示1,2,3,4个元素.很高兴看到索引为0的元素为null(我花了一些时间在调试时弄清楚我的问题,因为它没有显示).是否有可能强制intellij显示这个?
我使用Spring Boot 1.2.5创建了一个简单的REST Web服务,它适用于JSON,但我不能让这个工作返回XML.
这是我的控制器:
@RestController
..
@RequestMapping(method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
@ResponseStatus(HttpStatus.OK)
public List<Activity> getAllActivities() {
return activityRepository.findAllActivities();
}
Run Code Online (Sandbox Code Playgroud)
当我调用它时,Accept: application/json一切正常,但当我尝试时,application/xml我得到一些带有406错误和消息的HTML:
The resource identified by this request is only capable of generating responses
with characteristics not acceptable according to the request "accept" headers.
Run Code Online (Sandbox Code Playgroud)
我的模型对象:
@XmlRootElement
public class Activity {
private Long id;
private String description;
private int duration;
private User user;
//getters & setters...
}
@XmlRootElement
public class User {
private String name; …Run Code Online (Sandbox Code Playgroud)