You could embed Jetty inside your app (rather than deploying a war to tomcat) and run multiple copies taking a couple of command line params - namely port number and config file location.
N On Mar 5, 2013 7:19 AM, "MG" <miha.go...@gmail.com> wrote: > > > > You can try with different interfaces for the different beans, or by > using > > @ > > Qualifier > > > > I don't think I understand what do you mean here. > Do you propose I should have beanA and beanB in my application logic? If > so, this is just what I was trying to avoid, because the beautiful part of > the application is that I can have an implementation which isn't aware of A > and B scenario and doesn't have to be as long as the beans are initialized > correctly. Please correct me if I didn't understand you correctly. > > > > or you can even split the app in two - two different .war files that > share > > a common .jar. The wars just have different web.xml and > > applicationContext.xml > > > > > OK, this solution would probably work. It was one of the options I > considered before posting here, but I didn't like the overhead of packaging > and deploying multiple wars. > > Is there a third(fourth) option? > > > > > > On Tue, Mar 5, 2013 at 12:51 PM, MG <miha.go...@gmail.com> wrote: > > > > > Excuse me, if anyone is reading this for the second time, because I > > already > > > tried with this question on stackoverflow (with no luck). > > > > > > I'm developing a web application with Spring and Wicket. > > > > > > I would like to achieve, that different paths get different > > > applicationContexts loaded. *How can I do that?* > > > > > > For example: > > > > > > - http://myhost/ this in my entry page with some static data. > > > - http://myhost/A/(and all subfolders) gets loaded > > > applicationContext-A.xml > > > - http://myhost/B/(and all subfolders) gets loaded > > > applicationContext-B.xml > > > > > > Imagine that I have 2 databases which have the same structure, but hold > > > contextually different data. My application logic is the same for > both. I > > > just have to initialize different "dataSource" and a couple of other > > beans > > > initialized the-A-way or the-B-way. > > > > > > I managed to define two *WicketServlets (servletA and servletB)* in > > > *web.xml > > > * and I passed as a parameter the path to *applicationContext-A.xml* > and > > * > > > applicationContext-B.xml* respectively. > > > > > > The problem with this solution is, that I have to load the context in * > > > WebApplication* "by hand" and then get the beans out of it with > > > *getBean(..) > > > * methods, instead of just using *@SpringBean* to wire the beans > > > automatically. > > > > > > Best regards > > > > > > > > > > > -- > > Martin Grigorov > > jWeekend > > Training, Consulting, Development > > http://jWeekend.com <http://jweekend.com/> > > >