분류 전체보기
-
IoC - DI - Bean 의 관계회고/WIL 2023. 7. 4. 08:47
IoC - DI - Bean 의 관계 일반적으로 객체간의 관계를 설정할 때, 다음과 같이 설정을 한다. 만약에 다른 객체와의 관계가 필요한 경우에는? 기존에 있던 결합을 끊어내고 다른 객체와 관계를 맺도록 직접 해주어야 한다. 즉, 우리는 객체간의 관계를 코드 상에서 직접적으로 이어준다면, 다른 객체가 필요할 때마다 이를 바꿔주어야한다는 것이다. 다음의 코드를 보면서 설명해보자. MessageBean 인터페이스의 구현체인 MessageKor과 MessageEng 가 있다. DIMain 클래스에서 내가 MessageBean msg = new MessageKor(); 라고 입력하는 순간 이들간의 관계는 굳어진다. 즉, 결합도가 매우 높아지게 된다는 것이다. 만약 이렇게 이렇게 객체를 생성하고 관계를 맺을 때..
-
-
-
-
HTTP와 MVC회고/WIL 2023. 6. 25. 21:07
HTTP란? 우리가 브라우저를 통해서 데이터를 주고 받을 때, 아무런 제약없이 소통을 한다면? 브라우저로 부터 데이터를 받아 로직을 구성하고 이를 다시 반환해야 하는 서버에서는 참으로 난감한 상황이다. HTTP란 Hyper Text Transfer Protocol의 약자로 영어 단어 그대로의 의미를 해석하자면, 하나의 문서가 다른 문서로 이동할 수 있도록 해주는 하이퍼 텍스트를 전송하는 규약이라는 뜻이다. 우리가 아는 상황에 대입해서 설명하자면, 브라우저에서의 데이터를 주고받을 때 여러 규칙을 정해놓은 "통신 규약"을 말한다. 우리는 사진에서처럼 일정한 양식과 규칙을 가지고 잘 만들어진 데이터를 주고 받으므로써 Client에서 Server로 , 다시Server에서 Client로 데이터를 주고 받을 수 있..
-
-
OptionalJAVA/Optional 2023. 6. 22. 14:01
개요 자바를 하면서 우리는 수없이 많은 if문을 사용한다. 그중 일부는 들어온 변수가 null인지 아닌지를 확인하여 프로그램의 흐름에 영향을 주기 위해서나, 프로그램의 비정상적인 작동을 막기 위해서 사용한다. 간단하게 코드로 확인해보자 // User 클래스 파일 public class User { private Address address; public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } } //... // Address 클래스 파일 public class Address { private String street; public Address(){}..
-