I realize this is a slightly funky thing to need to do, but I'm trying to access my Spring messageSource bean from a custom Velocity tool.
In most of our codebase, I'm able to just set up a member variable and load it like this:
@Resource(name = "messageSource")
private AbstractMessageSource _msgSource;
However, in this circumstance, this doesn't load the bean, I'm assuming because the Velocity tools get instantiated in a way that doesn't allow normal bean loading to occur. Or it doesn't want to initialize the bean for an application scoped Velocity tool.
The tool is set up in the toolbox.xml as follows:
<tool>
<key>calendarTool</key>
<scope>application</scope>
<class>...</class>
</tool>
I haven't been able to find anything online that explains either how to do this or why it doesn't work.