쓰기전 네임스페이스 체크
applicationCTX.xml
<?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:c="http://www.springframework.org/schema/c"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="studentInfo1" class="com.javalec.ex.StudentInfo">
<property name="student">
<ref bean="student1"></ref>
</property>
</bean>
<bean id="student1" class="com.javalec.ex.Student" c:name="홍길동"
c:age="20">
<!-- <constructor-arg> <value>홍길동</value> </constructor-arg> <constructor-arg>
<value>19</value> </constructor-arg> -->
<constructor-arg>
<list>
<value>수영</value>
<value>요리</value>
</list>
</constructor-arg>
</bean>
<bean id="student3" class="com.javalec.ex.Student" c:name="홍길자"
c:age="30">
<!-- <constructor-arg> <value>홍길자</value> </constructor-arg> <constructor-arg>
<value>30</value> </constructor-arg> -->
<constructor-arg>
<list>
<value>히히</value>
<value>하하</value>
</list>
</constructor-arg>
</bean>
</beans>
applicationCTX.xml
<?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:c="http://www.springframework.org/schema/c"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="family" class="com.javalec.ex.Family" c:papaName="홍아빠"
c:mamiName="홍엄마" p:sisterName="홍누나" p:brotherName="홍오빠">
<!-- <constructor-arg> <value>홍아빠</value> </constructor-arg> <constructor-arg>
<value>홍엄마</value> </constructor-arg> <property name="sisterName" value="홍누나"/>
<property name="brotherName" value="홍오빠"/> -->
</bean>
</beans>
반응형
'자바과정 > 스프링' 카테고리의 다른 글
스프링 라이프사이클 실습(생명주기, Bean 객체 생성 - 소멸) (0) | 2021.04.06 |
---|---|
라이프 사이클이란? (0) | 2021.04.06 |
스프링 실습 예제 (어노테이션, Configuration/Bean) (0) | 2021.04.06 |
스프링 실습 예제코드 (0) | 2021.04.05 |
스프링 과 메이븐 디렉터리 구조 (0) | 2021.04.05 |
댓글