-
Notifications
You must be signed in to change notification settings - Fork 0
/
autowiringContext.xml
27 lines (22 loc) · 1.13 KB
/
autowiringContext.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- byName autowiring mode -->
<bean id="b" class="Autowiring.B"></bean>
<bean id="a" class="Autowiring.A" autowire="byName"></bean>
<!-- byType autowiring mode -->
<bean id="b1" class="Autowiring.B"></bean>
<bean id="a" class="Autowiring.A" autowire="byType"></bean>
<!-- constructor autowiring mode -->
<bean id="b" class="Autowiring.B"></bean>
<bean id="a" class="Autowiring.A" autowire="constructor"></bean>
<!-- no autowiring mode -->
<bean id="b" class="Autowiring.B"></bean>
<bean id="a" class="Autowiring.A" autowire="no"></bean>
<!-- multiple bean of one type, it will not work and throw exception. -->
<bean id="b1" class="Autowiring.B"></bean>
<bean id="b2" class="Autowiring.B"></bean>
<bean id="a" class="Autowiring.A" autowire="byName"></bean>
</beans>