JAVA를 잡아라!...
Spring Framework_NullPointerException 본문
애플워치로 메서드를 대신하려했음
근데 뭘 먼저할지 모름! 그래서 일단 new 모두 작성해놓음
그랬더니 결과가 객체가 너무 많이 생성됨
--> 멤버변수를 초기화하지 않아서 생긴 이슈
--> 생성자
// 생성자
// 생성자에 인자로 객체를 받아오면 강제성이 높아짐, new가 없어지기도함
public IPhone(AppleWatch appleWatch) {
this.appleWatch = appleWatch;
System.out.println("생성자를 통해 의존 주입");
}
'오류' 카테고리의 다른 글
MySQL_Unable to load authentication plugin 'caching_sha2_password'. (0) | 2024.03.13 |
---|---|
Spring Framework_dependency 부재 (0) | 2024.02.29 |
팀 프로젝트_리뷰작성_NumberFormatException, NullPointerException (0) | 2024.01.26 |
팀 프로젝트_회원가입_NullPointerException, ClassCastException (1) | 2024.01.21 |
JSP_NullPointerException & NumberFormatException (0) | 2024.01.05 |