I use my ColdSpring Bean Utilities (http://beanutils.riaforge.org/) to
autowire dependent ColdSpring beans into my transient objects (I use
Transfer but you can use your own factory if you wish and have the factory
perform the autowiring using the BeanInjector).

One note is that while you think it might be good to have a reference to a
Gateway, I'd assert that what you really want is a reference to a
ValidatorFactory within your bean. You call bean.validate(), it in turn
calls something like validatorFactory.getValidator(this).validate(). Then
your Validators can be specific to the object being validated (the factory
creates the right one for you), and you can have lots of other validation
logic in there aside from just hitting a gateway.

Just my .02.

On Thu, Apr 10, 2008 at 10:17 AM, Sam Clement <[EMAIL PROTECTED]> wrote:

> I've been using Coldspring for a while now and it's great, though I
> haven't really used it to do more than autowire services, gateways and
> DAOs.  I'm currently working on a project that doesn't use an ORM and have
> come into a validation stumbling block.  I'm using Brian Rinaldi's great
> Illidium cfcgenerator which creates a very useful validation method on the
> object's bean.  I want to be able to use a gateway from within this method
> to ensure that the record is unique.
>
> The problem for me is figuring out where to configure the gateway object.
> I'd like to be able to use Coldspring to inject the gateway into the bean
> (to be used by the validation method), however I think the problem is that
> Coldspring is best used for singletons and not for objects created at
> runtime.  If that's the case, is there a better way of getting the gateway
> into the bean than manually inserting it from a service?
>

Reply via email to