byName : 묶고자 하는 특성의 이름과 동일한 이름이나 ID를 가진 빈을 컨테이너에서 찾는다. 빈을 찾지못하면 그 특성은 묶이지 않은 채로 남는다.
byType : 묶고자 하는 특성의 타입과 동일한 타입을 가진 빈을 컨테이너에서 찾는다. 못찾으면 특성은 묶이지 않은 채로 남고, 하나 이상의 빈을 찾게 되면 UnsatisfieldDependencyException이 던져진다.
constructor : 묶고자 하는 빈의 생성자 중 하나의 파라미터와 맞는 하나 이상의 빈을 컨테이너에서 찾는다.
autodetect : constructor에 의한 자동 묶기를 먼저 시도한 다음, byType을 이용한다.
명시적묶기
<bean id = "courseService"
class = "com.springinaction.training.CourseServiceImpl">
<property name="courseDao">
자동묶기와 명시적묶기의 혼용
<bean id = "courseService"
class = "com.springinaction.training.CourseServiceImpl"
autowire="byName" />
<property name="courseDao">
<bean id = "courseService"
class = "com.springinaction.training.CourseServiceImpl">
<property name="courseDao">
<ref bean = "courseDao"/>
</property>
<property name="studentService">
<property name="studentService">
<ref bean = "studentService"/>
</property>
자동묶기
<bean id = "courseService"
class = "com.springinaction.training.CourseServiceImpl"
autowire="byName" />
자동묶기
<bean id = "courseService"
class = "com.springinaction.training.CourseServiceImpl"
autowire="byName" />
자동묶기와 명시적묶기의 혼용
<bean id = "courseService"
class = "com.springinaction.training.CourseServiceImpl"
autowire="byName" />
<property name="courseDao">
<ref bean = "courseDao"/>
</property>
자동묶기를 기본으로 설정
<beans default-autowire="byName">
자동묶기를 기본으로 설정
<beans default-autowire="byName">