Java 14

springboot로 Rest api 만들기(6) ControllerAdvice를 이용한 Exception 처리

전체 소스코드 https://github.com/GHGHGHKO/Springboot/tree/main/pepega_chapter_6 GitHub - GHGHGHKO/Springboot: 블로그에 업로드 된 소스코드 블로그에 업로드 된 소스코드. Contribute to GHGHGHKO/Springboot development by creating an account on GitHub. github.com ​ 이전 포스팅에서는 본격적으로 API 서버 개발을 하기 전 API 인터페이스 및 결과 데이터 구조를 살펴보고 확장 가능한 형태로 설계해보았다. ​ API 성공에 대한 내용만 포스팅했지만 이번 포스팅에는 실패 시 ExceptionHandling과 결과 Message 처리에 대한 내용을 살펴보도록 하겠다...

SpringBoot 2021.10.22

Overloading, Overriding (Java)

- 오버로딩(overloading) : 기존에 없는 새로운 매서드를 정의하는 것 - 오버라이딩(overriding) : 상속받은 메서드의 내용을 변경하는 것 ​ 출처: https://all-record.tistory.com/60 [세상의 모든 기록] 오버라이딩(Overriding) 오버라이딩이란? 부모 클래스로부터 상속받은 메서드의 내용을 변경하는 것을 오버라이딩이라 한다. 간단히 말하면 메서드를 다시 정의하는 것이다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 public clas all-record.tistory.com ​ 오버로딩(overloading) //Overloading.java class Overloading { void overloadinTest() ..

Java 2021.10.21

java 클래스 구현, 상속, 자동차 예제

//Car.java public class Car { private String carname; //차 이름 protected int speed; //차 속도를 수정해야하기 때문에 protected public Car() {} public Car(String carname) //생성자 { this.carname = carname; //차 이름 this.speed = 100; //차 속도 설정 (100이 기본) } public String getName() { return this.carname; } public int getSpeed() { return this.speed; } public void setSpeedUp() { speed += 10; } public void setSpeedDown() { ..

Java 2021.10.21

java 상속 관계 구조 구현(학생 예제)

//Student.java public class Student { private String student_name; //학생 이름 private int computer_grade; //컴퓨터 점수 public Student() {} public Student(String student_name, int computer_grade) //생성자 { this.student_name = student_name; //학생 이름 this.computer_grade = computer_grade; //컴퓨터 성적 설정 } public String getName() { return this.student_name; } public int getAverage() { return this.computer_grade; ..

Java 2021.10.21