<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=thomasw" rel="nofollow">Thomas Whitmore</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-1662?redirect=false" rel="nofollow">SPR-1662</a></strong> and commented</p>
<p dir="auto">Hi Juergen, people,</p>
<ol dir="auto">
<li>
<p dir="auto">Working on a project now I'd like to use Spring to configure the Dispatcher behaviour of DispatcherServlet; which seems impossible since it's outside the BeanFactory Context.</p>
</li>
<li>
<p dir="auto">On a recent Struts -&gt; Spring transition project, referencing from Struts Dispatcher to Spring-created Beans was wanted alongside some use of the Spring Dispatcher. Available and recommended solutions seemed to either create duplicate BeanFactories, or to hit some kind of infinite recursion loop, or to be unable to find the BeanFactory due to initialization issues.</p>
</li>
</ol>
<p dir="auto">It seems that the coupling of Dispatcher and BeanFactory behaviour directly into the Dispatcher Servlet, may be a less-than-perfect architectural structure.</p>
<p dir="auto">The Struts -&gt; Spring transition in particular wasted a lot of time trying to integrate these alongside, without suffering infinite recursion. We found it insoluble in the end and needed to convert everything to Spring to continue (a rather costly decision, and also a significant hurdle which some might have chosen <strong>not</strong> to cross).</p>
<p dir="auto">These seemed at the time to be <strong>general</strong> issues, which would affect many Development Transitions from other frameworks/ code into Spring. Much of it was the issue of Referencing beans from outside Spring, versus Creating an entirely new bean factory.</p>
<p dir="auto">As possible improvement in these areas, I'd like to propose the following :-</p>
<ul dir="auto">
<li>allow separation of Dispatcher behaviour from SpringServlet bean-factory creation and loading</li>
<li>Dispatcher could then be created/ configured explicitly within Spring; defaulted if not</li>
<li>SpringServlet to handle bean-factory loading; still parameterized from Servlet Params</li>
<li>allow Dispatcher.HandlerMappings to be specified<br>
(single HandlerMapping can currently be set as a servlet-param, but this is outside Spring)</li>
<li>SpringServlet able to be registered/ found globally; both during loading and once complete</li>
</ul>
<p dir="auto">And, less generally but still important :-</p>
<ul dir="auto">
<li>Struts integration plugs able to find SpringServlet/ or other bean factory; rather than forcing to load a duplicate.<br>
(recent work may have progressed towards covering this.)</li>
</ul>
<p dir="auto">Your thoughts ?</p>
<p dir="auto">FYI, on the previous project I also implemented Struts Tag -&gt; Spring message resolution support (cleanly) and Struts Validator support from outside Struts (a blatant hack). Overall I found there was rather a lot of work in several areas to implement the transition from Struts -&gt; Spring. Since this must be one of the most common migration paths, surely this would benefit from some smoothing...</p>
<p dir="auto">Unfortunately I've since moved on, and may only have some of the source code for the above components. Let me know if you'd like me to have a hunt for it.</p>
<p dir="auto">Cheers,<br>
T</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.2.6</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=mediaslave" rel="nofollow">Tyler Nelson</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-1300?redirect=false" rel="nofollow">SPR-1300</a></strong> and commented</p>
<p dir="auto">In LocalSessionFactory mappingLocations can have duplicate hbm.xml files as resource[].  However this  can cause<br>
org.hibernate.MappingException: duplicate import when LocalSessionFactory loads the same hbm.xml multiple times.</p>
<p dir="auto">This can be handled by putting a quick lookup check before a new mappingLocation is added or by saving mappingLocations as a Set of Resources.</p>
<p dir="auto">This can happen when the hbm.xml files exist in both src and classes in a development enviorment. So it isnt an issue with prod. And there is dev workaround(By manuall deleting the extra files or fixing the classpath ). Also one would could say that the build process classpath should address this problem. But it would still be a nice to have.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.2.4</p>
<p dir="auto">1 votes, 1 watchers</p>