On Fri, 2005-03-18 at 14:41, Carsten Ziegeler wrote: > Hi, > > I just committed the inital version under > https://svn.apache.org/repos/asf/cocoon/blocks/spring-app/trunk > > The readme.txt explains howto include the block in the build and howto > see the nice example :) > > The block is not finished yet. You currently are able to define a spring > application context on a per sitemap base and can use flow and the > service manager to lookup your beans - a simple example for flow is > included. > Currently missing is the chaining of spring contexts and some further > glue code. > > I think we should use this block as a prototype and discuss/see what > else is needed/can be done. So everyone is of course invited to improve > the functionality. > > Carsten
Hi Carsten, first: I really appreciate work towards Spring integration into Cocoon. Unfortunately I'm a old Cocoon 2.1.x guy and I do not know Cocoon 2.2 very good. However, I'm using Spring and Cocoon 2.1.x heavily and want to tell you some of my thoughts. I looked at the example you (Carsten) provided in the spring-app block. The flow.js is as follows: function test() { var component = cocoon.getComponent("spring-test"); var core = cocoon.getComponent("cocoon-core"); cocoon.sendPage("test", { "message" : component.getMessage(), "configuration" : core.getSettings().getConfiguration()}); } What I don't like in my Spring/Cocoon apps (which is also the problem here) is: Spring is great in dependency injection and I want to avoid obtaining components direct via any component manager. So, a short idea to solve this could be to extend the flow declaration in the sitemap: <map:flow language="javascript"> <map:script src="flow.js"> <property name="myBean"><ref bean="spring-test"/></property> </map> </map:flow> MyBean is than automatically "injected" into the flow context so that i can simply write sth. like function test() { myBean.getAProperty(); } This is not only related to flow and Spring but to flow use and dep. injection in general doesn't matter what container is used. Now, I will go and play with Cocoon 2.2 and Spring a bit. Thanks Carsten, nice work. -- Rolf Kulemann