2
으로 내 응용 프로그램을 사용 스프링 부팅을 작동하지.
도와주세요. 감사합니다. 코드 :봄 부팅 RestController는 좋은 작품, 롬복 롬복
@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;
}
}
다음과 관련이있을 수 있습니다 : http://stackoverflow.com/a/37842512/475116 그럼'롬복 '이 잘 구성되어 있습니까? getter와 setter를 생성하지 않는 것 같습니다. – Pau
개인적인 경험으로는 lombok Getters/Setters 주석이 완벽하게 작동하지만 데이터에 오류가 발생하는 경우가 있습니다. 속성 수준에서 Getter/Setter를 사용하는 것이 좋습니다 – cralfaro
대답 해 주셔서 감사합니다. Intellij 아이디어로 인해 발생합니다. 롬복은 잘 구성되어 있지 않다. – user3172755