# setter은 property 태그를 생성자는 constructor-arg 태그를 사용한다.
# DI의 활용 (construct-생성자 이용하기)
Student.java | |||
|
StudentInfo.java | |||
|
MainClass.java | |||
|
applicationCTX.xml | |||
| |||
bean이 두 가지가 있는데 "student1"로 "studentInfo"의 생성자로 설정하고 MainClass.java 파일을 보면 마지막에 setter방법을 이용하여 "student2"를 설정한다. => 생성자와 setter방법의 차이를 확인할 수 있다. | |||
'그 외 공부 > SPRING' 카테고리의 다른 글
spring framework[5] - life cycle and scope, 외부파일을 이용한 설정 (0) | 2018.01.09 |
---|---|
spring framework[1] - DI, IOC (0) | 2018.01.06 |