So what I think you want to do here is, you have pretty much all of
your beans defined in a gobal coldspring config file, that all
instances of the app will load, then for each instance, you would
like to load one specific version of the simpleConfig bean, correct?
As dave says, you can allow mg to load the core coldspring config
file via modelglue's properties, so the tricky part is going to be
adding that last bean.
OK, it's now much later, I couldn't get to this during work, sorry. I
was going to go down the road of doing something along the lines of
Sean's original Autowiring controller, where the first controller
loaded would retrieve the beanFactory and call loadBeans() as Dave is
saying. However now that I look at ModelGlue code, you're right that
GetBeanFactory() is a private method. I also think that would be a
problematic approach, because Joe is changing the way that
controllers are loaded so that autowiring to managed beans is done
early by the framework. I think you're kind of out of luck at the
moment, but maybe we can address this with new updates to ColdSpring
and ModelGlue. For now, it looks like you are going to need to have a
main config file per app instance. Unfortunately I can describe a
method that would work with Mach-ii, but it's more complicated than I
think you are probably after. Sorry, not too much help here!
On Jan 25, 2006, at 8:58 AM, Dave Ross wrote:
Seth,
While I'm not incredibly familiar with ModelGlue, I'll try to answer.
Am I correct in assuming that you have a MG app that you want multiple
"instances" of (meaning although it's the same codebase you are going
to run a separate MG app for each domain). The reason I'm assuming
this is that you wouldn't be able to have one single instance of the
app but at the same time multiple "simpleConfig" beans (how would the
other beans know which one to use?).
So, assuming that, I think what you are asking is how do I separately
add beans to the ColdSpring beanFactory? This is actually rather
easy... you need only use one of the loadBeans() method on the
BeanFactory itself (MG'ers on the list - you can "get at" the
BeanFactory, correct?).
So basically when the app starts up, you would find your
domain-specific simpleConfig definition and add it to the beanFactory
(ColdSpring won't resolve dependencies until it is asked for a bean -
so the dependency injection features should work).
Does that help? Chris may be able to clarify as he has more MG
experience.
-Dave
On 1/24/06, Seth MacPherson <[EMAIL PROTECTED]> wrote:
Hello all,
I'm getting started with ColdSpring and enjoying all that it has to
offer. I have a bit of a problem - perhaps without a simple answer.
I have a Model-Glue application that's using ColdSpring and I want to
load/create a bean that is not specified in the AllBeans.xml file.
<!--- Taken From ModelGlue.xml --->
<setting name="beanFactoryLoader"
value="ModelGlue.Core.ColdSpringLoader" />
<setting name="beanMappings" value="/config/beans/AllBeans.xml" />
The site I'm building is going to be shared across multiple
domains. I
would like to load domain specific settings as a singleton bean and
passed around under a common name - appSettings. Is that possible?
<!--- Bean I'm attempting to load dynamically from dynamic folder
name
--->
<?xml version="1.0" encoding="utf-8"?>
<bean id="simpleConfig"
class="ModelGlue.Bean.CommonBeans.SimpleConfig">
<property name="profile">
<struct>
<entry key="SkinName">
<value>default</value>
</entry>
<entry key="ThemeColor">
<value>red</value>
</entry>
<entry key="IconColor">
<value>red</value>
</entry>
<entry key="SiteTitle">
<value>mys site name</value>
</entry>
<entry key="DomainName">
<value>mysite.com</value>
</entry>
<entry key="Mode">
<value>Dev</value>
</entry>
<entry key="Version">
<value>0.02</value>
</entry>
<entry key="DefaultLanguage">
<value>English</value>
</entry>
<entry key="isDebugMode">
<value>false</value>
</entry>
<entry key="DefaultEvent">
<value>home.start</value>
</entry>
<entry key="ViewMappings">
<value>/views</value>
</entry>
</struct>
</property>
</bean>
Thanks in advance for any feedback.
- Seth MacPherson