Saturday, December 09, 2006

Hidden Gems Notes

"classpath:" vs "classpath*:"
In the first, it gets the first classpath root only.
The second will check all classpath roots.

Both support patterns
I will probably avoid the wild card pattern bit because of my preference for explicit definitions. Still, good stuff for parallel classpaths and resource roots.

Advanced Resource Bundles

ResourceBundleMessageSource: uses java.util.ResourceBundle, can load from multiple bundle basenames, can handle message arguments via java.text.MessageFormat
ReloadableResourceBundleMessageSource, think resource bundles that can be reloaded at runtime. woohoo! has configurable caching and refresh.
Sample definition:

<bean id="messageSource" class="">
<property name="basename" value="classpath:myBundle1,classpath:myBundle2" />
<property name="cacheSeconds" value="1" />
<property name="defaultEncoding" value="UTF-8" />
<property name="fileEncodings">

Note: storing reloadable resources in the classpath may not be the best practice. But, probably use in a dev environment tied to a server. Just change before go-live.
The encoding stuf is good but, anybody working for me will save EVERYTHING as UTF-8 if they know whats good for them

ServletRequestDataBinder - I need to investigate this more

Links to this post


At 09 December, 2006 20:22, Anonymous doyle said...

You can probably tie the reload to the logging level so you don't have to mess with removing the configuration. Sorta what the rails kids do with the dev > test > prod settings.

We should do that in our app.

At 10 December, 2006 14:00, Blogger willCode4Beer said...

For log4J, its a good idea.
I'd recommend getting the configuration properties out of the classpath though.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Links to this post on:

Create link here by posting on Blogger