Leszek Gawron wrote:
One VERY important question concerning cocoon core? Why is it based
on spring's BeanFactory and not on ApplicationContext? I propose to
switch from CocoonBeanFactory to CocoonApplicationContext. WDYT?
I'm +1 for this - the original code I wrote actually used a
CocoonApplicationContext. Daniel had some concerns about it (I think it
was mainly about too many dependencies) and we switched to the simpler
bean factory. Perhaps Daniel recalls why we switched back?
Now I had some problems with the current implementation as well, for
example ServletContextAware is not handled by the bean factory, so I
extended our CocoonBeanFactory to handle this. An application context
already provides this functionality. So, +1 for this.
This is something I have no idea how to do properly. Looking at
AbstractApplicationContext it looks like we can keep current
CocoonBeanFactory and just use it while creating application context.
Unfortunately there is a lot of custom lifecycle code in
CocoonBeanFactory that I do not know how to modify (ServletContextAware
which you mentioned, some preInstantiateSingletons method that does bean
post processing and so on). Any guidelines?
Moreover the root context should be at least a
ConfigurableWebApplicationContext that should be registered properly in
servlet context. For now none of spring related servlet filters work
because they all rely on WebApplicationContextUtils [1] (and this one
throws not finding spring context in servlet context).
I had to move all META-INF/spring/*.xml to META-INF/springX/*.xml so
cocoon does not pick those automatically and build myself a separate web
application context with spring's ContextLoaderListener.
[1]
http://www.springframework.org/docs/api/org/springframework/web/context/support/WebApplicationContextUtils.html
--
Leszek Gawron, IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65