티스토리 뷰
원문 : http://sewony.tistory.com/entry/BlazeDS-와-스프링Spring-연동하기
BlazeDS 와 스프링(Spring) 연동하기
BlazeDS를 이용하여 Remote Object Service를 이용할 때 스프링과 연동할 수는 없을까 라는 의문을 가지고
자료를 찾아보았습니다. 역시 이미 연동해서 사용하는 방법이 있더군요
다음의 remoting-config.xml 파일을 봅시다.
<destination id="simpleLoadService">
<properties>
<factory>springfactory</factory>
<source>simpleLoadDao</source>
</properties>
</destination>
일반적인 destination을 정의하는 부분과 다릅니다. 바로 <factory>라는 부분인데요, springfactory 라는
새로운 factory를 정의해서 스프링과 remote object를 연결시실수 있습니다.
그러면 springfactory 가 정의된 부분이 있어야 겠죠?
바로 services-config.xml 파일에 정의합니다.
<factories>
<factory id="springfactory" class="flex.messaging.factory.SpringFactory" />
</factories>
위의 내용이 springfactory를 정의한 부분입니다.
이제 이 factory를 통해서 스프링과 remote object가 연결됩니다.
그러면 flex.messaging.factory.SpringFactory 는 원래 flex package에 존재하는 클래스일까요?
그렇지 않습니다. 스프링과의 연동을 위해 따로 제작된 클래스죠. 저도 외국 사이트에서 다운로드 했습니다.
첨부파일로 올리니 다운 받아서 lib에 등록해서 사용하시면 됩니다..
remoting-config.xml 에서 source로 설정되어 있는 simpleLoadDao도 마저 살펴봅시다.
스프링의 bean설정파일인 applicationContext.xml 파일에 등록되어 있겠죠.
applicationContext.xml
<bean id="simpleLoadDao" class="flexintegration.spring.sample.SimpleLoadDao">
<property name="sqlMapClient" ref="sqlMapClient" />
</bean>
<!-- SqlMap setup for iBATIS Database Layer : 스프링 프레임워크와 iBATIS의 연동 -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="WEB-INF/ibatis/sql-map-config.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
이렇게 설정이 되면 Remote Object로 바로 스프링의 DI(Dependency Injection)를 이용하는 bean을
사용할수가 있게 됩니다. ( iBatis를 이용하고 있어서 iBatis에 대한 경험이 없으시면 약간 이해하기
힘들수도 있겠네요 )
여기까지 Remote Object로 스프링 bean을 연동해서 사용하는 방법에 대해서 알아보았습니다.
Remote Object로 스프링의 강력한 DI를 바로 사용할 수 있다는 건 대단한 장점이죠.
참고로 AOP도 Remote Object 사용시 제대로 동작합니다. ( 테스트 해 보았죠 )
스프링과의 연동을 생각하셨던 분들에게 도움이 되셨기를...
'Web > Flex' 카테고리의 다른 글
BlazeDS와 LCDS의 기능 차이 (0) | 2011.11.18 |
---|---|
BlazeDS 설치하기 (0) | 2011.11.18 |
BlazeDS 란? (0) | 2011.11.18 |
- Total
- Today
- Yesterday
- 송도자이더스타
- 청약접수
- 네오
- 입주자모집공고
- 영백홀
- 센트레빌아스테리움영등포
- 커트라인
- Neo
- 관악중앙하이츠포레
- 경쟁률
- e편한세상강일어반브릿지
- 트레이더스
- 북서울자이폴라리스
- 당첨가점
- 검단신도시
- 동탄2신도시
- QM5
- 송도자이크리스탈오션
- 청약접수현황
- 금강펜테리움더시글로
- 힐스테이트광교중앙역퍼스트
- 현황
- 특별공급
- 제일풍경채
- 동탄역
- 일반공급
- 고덕강일
- 분양가
- 자양하늘채베르
- 케이카 워런티
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 28 | 29 | 30 | 31 |