Custom Loader Follow-up
"Scott Purcell" <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <OF6F583766.CF02AAC0-ON862575C3.004F8EFD-862575C3.004FFF3C@mastercard.com> |
I am spending way too much time on this Freemarker configuration for a
stand-alone application. I am not dealing with a web-app.
I need to be able to use my DB for templates. So I created two custom
TemplateLoaders. I added the following in my Spring.xml file.
<bean id="freemarkerLoaderConfiguration" class=
"org.springframework.ui.freemarker.FreeMarkerConfigurationFactory">
<property name="templateLoaders">
<list>
<ref bean="eventTemplateLoader" />
<ref bean="EventTemplateLoaderOther" />
</list>
</property>
</bean>
Each template serves a specific template. Or at least that is how we want
it to work.
Now I have a test harness to pull the templates out and run the conversion
on them. This is where all the problems begin to fold.
I have the folloiwng in a test class.
// first pull out the bean
FreeMarkerConfigurationFactory factory = (
FreeMarkerConfigurationFactory
)SpringUtil.getApplicationContext().getBean("freemarkerLoaderConfiguration");
Configuration config = factory.createConfiguration();
// how to pull by name, as a list doesn't have names.
Template template =
config.getTemplate("EventTemplateLoaderOther");
Not this works, but it always pulls the first "eventTemplateLoader"
from the list out. There is no where to associate a name with the class
using this mechanism. So how is this accomplished?
Thanks,
CONFIDENTIALITY NOTICE
This e-mail message and any attachments are only for the use of the intended recipient and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient, any disclosure, distribution or other use of this e-mail message or attachments is prohibited. If you have received this e-mail message in error, please delete and notify the sender immediately. Thank you.
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user