Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Sunday, February 19, 2006

Tapestry-Spring update

James Carman pointed out that I had mis-packaged the hivemodule.xml inside WEB-INF, not META-INF. This is what happens when you switch contexts 5,000 times per day. I've fixed this and updated the 0.1.1 distro in the repository. Also, I probably should be appending "-snapshot" to the version number (I have to see if that operates the same in the Maven 2 world as in the Maven 1 world).

4 comments:

Matt Raible said...

Does this release allow you to easily set multiple Spring context files?

Xavier Dury said...

I've been successfully using multiple context files by implementing a mechanism of ResourceContribution (thanks to HiveMind's feature to design your own schemas).

I ended up with something like this in my hivemodule.xml:

<schema id="ResourceContributions">
...
</schema>

<configuration-point id="ApplicationContextResources" schema-id="ResourceContributions"/>

<contribution configuration-id="ApplicationContextResources">
<resource path="../serviceContext.xml"/>
<resource path="../persistenceContext.xml"/>
<resource path="../applicationContext.xml"/>
</contribution>

<service-point id="ApplicationContextBuilder" interface="org.apache.hivemind.ServiceImplementationFactory"/>
...
</service-point>

the ApplicationContextBuilder would take the ApplicationContextResouces contribution to build an appropriate ApplicationContext.

Anonymous said...

I'm just curious about why did you decide to provide creation and destruction of Spring's ApplicationContext as part of Tapestry-Spring lifecycle?

Wouldn't it be easier and more flexibile if you only took care of fetching Spring's beans from ApplicationContext (which resides inside ServletContext), and leave to developers to use default ContextLoaderListener way, or whatever way they want, now and forever?

Less is more ;)

Then again, maybe I'm missing something here ...

Howard said...

My original thought was that you shouldn't even have to do configuration in web.xml to make it work. However, that's proving problematic, so the next "release" will require the normal Spring configuration, and will just "expose" that context to HiveMind.