cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <>
Subject Re: [blocks] Intialization sequence question
Date Sun, 08 Oct 2006 23:53:16 GMT
Daniel Fagerstrom schrieb:
> A technical question for the Spring experts:
> In the current implementation of the blocks fw the BlockServlet is a 
> Spring managed component, but it gets init and destroy methods are 
> called in the DispatcherServlet. After having fought a little bit more 
> about it (and experienced some subtle initialization order problem that 
> I had to hack around), I have realized that it not is such a good idea 
> to let the DispatcherServlet have any part in the initialization. This 
> is both from a SoC perspective and from the fact that the 
> DispatcherServlet doesn't know anything about the dependency graph of 
> the BlockServlet components.
> The conclusion is that all setup of the BlockServlet should be performed 
> by the Spring container. The natural way to do this seemed for me to let 
> the BlockServlet implement the Spring interfaces: ServletConfigAware (so 
> that it get the servlet config that the Spring web context uses) and 
> InitializingBean and DisposableBean, for actually calling the Servlet 
> init and destroy methods.
> While trying that, the container is unhappy with the ServletConfigAware 
> and says that it doesn't have any servlet config. Before trying to dig 
> into exactly what happens, I would like to hear from the Spring experts 
> (Carsten e.g.) if you have any idea about what I'm missing. Here is the 
> stack trace:
The servlet config is not set on the web application context. Only the
servlet context is available. According to the Spring docs, the servlet
config is only available if the application context belongs to a
specific servlet.
Sorry, I just landed in Dallas some hours ago, so I can't fully
concentrate right now, but wouldn't you create a spring application
contxt for the block which then creates a servlet config for that block

Carsten Ziegeler - Open Source Group, S&N AG

View raw message