Easy ColdSpring in Model-Glue

from:  http://clearsoftware.net

Dave Ross and Chris Scott are doing an _amazing_ job with the ColdSpring project. For those of you who aren't familiar with Spring, it's a Java framework that provides a number of services such as IoC (like ConfigBeans in Model-Glue), Aspect Oriented Programming, and ORM functionality amongst many things. Right now, ColdSpring is at 0.2.1 and provides IoC and Aspect Oriented functionality.

Summary for the impatient - how to use ColdSpring seamlessly Model-Glue in four steps:

 

ColdSpring is very nice, and Dave's done some nice work on Model-Glue integration that I decided to wrap into the framework itself, building some functionality into the Bleeding Edge Release of Model-Glue (svn://clearsoftware.net/clearsoftware.net/ModelGlue) that'll let you seamlessly use ColdSpring.

Just add the following line of code to your ModelGlue.xml file:

 

<setting name="beanFactoryLoader" value="ModelGlue.Core.ColdSpringLoader" />

Then change the beanMappings setting to your ColdSpring .xml file:

 

<setting name="beanMappings" value="/modelgluesamples/coldspring/config/beans/AllBeans.xml" />

Once that's done, if you do getModelGlue().getConfigBean(), instead of passing the filename of an XML file to get, just pass the ID of the ColdSpring bean to load.

If you get the latest M-G BER, you'll notice there's a modelgluesamples/coldspring app that shows it in action. The thing just _worked_ on the first try.

Credit goes to Dave - he basically wrote the code to do it all, I just used the pluggable part of Model-Glue 1.0 to make it go.

Note: There are things to think about when using ColdSpring as the native bean factory in Model-Glue. You won't be able to use existing ChiliBean beans unless you create the ChiliBean BeanFactory by hand, so it's not something to implement mid-project. However, it wouldn't be hard to move ChiliBean XML files into a ColdSpring XML doc.

 

  1. Get latest from the BER Subversion repo.
  2. Add <setting name="beanFactoryLoader" value="ModelGlue.Core.ColdSpringLoader" /> to your ModelGlue.xml
  3. Change the beanMappings setting to the path to your ColdSpring xml: <setting name="beanMappings" value="/modelgluesamples/coldspring/config/beans/AllBeans.xml" />
  4. Instead of GetModelGlue().GetConfigBean("myBeanFileName.xml"), use GetModelGlue.GetConfigBean("ColdSpringBeanId")
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值