Мое приложение использует весеннюю загрузку с ломбоком, когда я использую @Data
, аннотация вызовет
java.lang.IllegalArgumentException: No converter found for return value of type.
Когда я пишу геттер и сеттер, он работает хорошо.
Пожалуйста, помогите мне, спасибо; Код:
@RestController
@RequestMapping("/user")
public class UserController {
@GetMapping("/{id}")
public User query(@PathVariable long id) {
if (id == 1L) {
return new User(1l);
} else {
return new User(2L);
}
}
}
@Data
public class User {
private long userId;
private String userName;
private String password;
private String mobile;
private String address;
public User() {
}
public User(long userId){
this(userId, "zhengfc", "pwd", "13322222222", "shanghai-zhengjiang");
}
public User(long userId, String userName, String password, String mobile, String address) {
this.userId = userId;
this.userName = userName;
this.password = password;
this.mobile = mobile;
this.address = address;
}
}
lombok
правильно настроен? Похоже, не генерирует геттеры и сеттеры. - person Pau   schedule 21.10.2016lombok
плохо настроена - person user3172755   schedule 22.11.2016