웹 & 프레임워크

Spring 참조시키는거 좀 쉽게 Namespace - p를 체크하고 이용해서 해보자.

늘근이 2014. 6. 27. 14:18

<?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/beanshttp://www.springframework.org/schema/beans/spring-beans-3.2.xsd">

 

<!-- <bean id="greeting" class="com.gorakgarak.sample1.setter.GreetingServiceImpl">

                  setter : setOutputter호출

                  <property name="outputter">

                                   <ref bean="outputter"/>

                  </property>

                  </bean>

<bean id="outputter" class="com.gorakgarak.sample1.setter.OutputServiceImplFile">

                  <property name = "fileName">

                  <value>message.Text</value>

                  </property>

 

</bean> -->

                 

<bean id="greeting" class="com.gorakgarak.sample1.setter.GreetingServiceImpl"

p:outputter-ref="outputter" />

 

<bean id="outputter" class="com.gorakgarak.sample1.setter.OutputServiceImplFile"

p:fileName="log.txt" />

 

 

</beans>

 

//====================================================================

//p는 프로퍼티 의 약자이다!

'웹 & 프레임워크' 카테고리의 다른 글

Spring Auto-Wire, ByType, ByName  (0) 2014.06.27
Spring 싱글톤 설계  (0) 2014.06.27
Spring bean 사용법  (0) 2014.06.27
Spring 구조 그림  (0) 2014.06.27
Spring DI(Dependency Injection) 출력도우미  (0) 2014.06.27