ColdSpring Constructor args

6 views
Skip to first unread message

Dan Vega

unread,
Sep 8, 2011, 11:08:15 PM9/8/11
to col...@googlegroups.com
I am working on a small sample application for Hyrule and I am having an issue. The constructor in Hyrule takes a struct with 1 or many params. In this example I am trying to pass in 2 values. 

<?xml version="1.0" encoding="UTF-8"?>
<beans>
<bean id="validationService" class="hyrule.system.core.Hyrule" singleton="true">
<constructor-arg name="config">
<map>
<entry key="validator">
<value>annotation</value>
</entry>
<entry key="rbPath">
<value>/hyrule/samples/frameworks/coldmvc/public/i18n</value>
</entry>
</map>
</constructor-arg>
</bean>
</beans>

Whenever I run this I am getting the following error. I am not trying to call a setter, I want these values passed right into the constructor.. what am I doing wrong? 

The method setconfig was not found in component C:\www\hyrule\system\core\Hyrule.cfc.



Ryan Ricard

unread,
Sep 9, 2011, 10:12:39 AM9/9/11
to ColdMVC
I have not yet used a coldspring.xml file with ColdMVC; regardless,
your configuration looks spot on according to the ColdSpring Docs --
perhaps constructor-args are not support by Tony’s “ColdSpring Lite”.

There is the approach of injecting properties into your components
with the config.ini...

From the ColdMVC docs (http://www.coldmvc.com/guide/config-variables):
"You can pass complex values into your beans by using JSON syntax for
the value of your config setting. The bean factory will automatically
convert the JSON string into a complex object before injecting the
property into the component. The following example will inject an
array into the setBar method on the fooServicesingleton bean.
fooService.bar=["boo", "baz"]"

In your case… in your config.ini, you would set:
validationService.config={validator: ”annotation”, rbPath: “/hyrule/
samples/frameworks/coldmvc/public/i18n”}

Dan Vega

unread,
Sep 9, 2011, 10:15:01 AM9/9/11
to col...@googlegroups.com
That is the problem though, it will still end up calling a setter for config which I don't have. These are config options that are passed in on construction. Thanks for the help though. 

Tony Nelson

unread,
Sep 12, 2011, 9:15:08 PM9/12/11
to col...@googlegroups.com
Right now constructor arguments aren't supported with the simplified version of ColdSpring that ColdMVC uses. I can try to add them sometime this week if you want.

-Tony

Tony Nelson

unread,
Sep 13, 2011, 5:49:57 AM9/13/11
to ColdMVC
Constructor arguments are now supported in the latest version of
ColdMVC. Your above code should work as expected if you pull an
update.

On Sep 12, 8:15 pm, Tony Nelson <tonynelso...@gmail.com> wrote:
> Right now constructor arguments aren't supported with the simplified version
> of ColdSpring that ColdMVC uses. I can try to add them sometime this week if
> you want.
>
> -Tony
>
> On Fri, Sep 9, 2011 at 9:15 AM, Dan Vega <danv...@gmail.com> wrote:
> > That is the problem though, it will still end up calling a setter for
> > config which I don't have. These are config options that are passed in on
> > construction. Thanks for the help though.
>
> > Thank You
> > Dan Vega
> > danv...@gmail.com
> >http://www.danvega.org/

Dan Vega

unread,
Sep 13, 2011, 8:25:03 AM9/13/11
to col...@googlegroups.com
Awesome! I will pull it down later and update my example application, thanks Tony! 
Reply all
Reply to author
Forward
0 new messages