|
From: Colin S. <col...@ex...> - 2004-01-21 19:34:09
|
Sure, if you point to two different places on the filesystem,
FileSystemXmlApplicationContext would work fine. However, usually it's
not very convenient to point to hard-coded locations.
Kopylenko, Dmitry wrote:
>Well, since ClassPathXmlApplicationContext extends
>FileSystemXmlApplicationContext, it wouldn't work, would it? ;-)))
>
>Dmitriy.
>
>-----Original Message-----
>From: Kopylenko, Dmitry [mailto:dko...@ac...]
>Sent: Wednesday, January 21, 2004 2:18 PM
>To: 'spr...@li...'
>Subject: RE: [Springframework-developer] ClassPathXmlApplicationContext is
>sue.
>
>
>.... Or use FileSystemXmlApplicationContext
>
>Regards,
>Dmitriy.
>
>-----Original Message-----
>From: Colin Sampaleanu [mailto:col...@ex...]
>Sent: Wednesday, January 21, 2004 1:09 PM
>To: spr...@li...
>Subject: Re: [Springframework-developer] ClassPathXmlApplicationContext
>issue.
>
>
>Pedro,
>
>Spring does no manipulation of the classpath. It uses whatever classpath
>is given to it; generally this is the current thread's context
>classloader's classpath, as set by whatever environment it is in.
>
>If there are two application context definition files with the same name
>available on the classpath, then generally Spring will load whichever
>one the classloader returns. If this behaviour is not acceptable, then
>you have to have unique names...
>
>Regards,
>Colin
>
>pedro.costa wrote:
>
>
>
>>Hi all,
>>
>>I'm trying to load two different applicationContext xml file using
>>ClassPathXmlApplicationContext.
>>
>>The files have the same name, but are on diferent class paths.
>>
>>What is happening is that it seams that spring is always finding the
>>same file in both cases, regardless of the classpath that is used when
>>
>>
>creating ClassPathXmlApplicationContext.
>
>
>>I can see it from the logs.
>>
>>If i change the name of one of the files, it works fine.
>>
>>Is this a known problem?
>>
>>here is the code:
>>
>>ClassPathXmlApplicationContext appContext = new
>>ClassPathXmlApplicationContext("replica/command/beans/beans.xml");
>>
>>BeansMappings beansMappings =
>>(BeansMappings)appContext.getBean("serverCommandMappings");
>>
>>// no problem here ...
>>
>>ClassPathXmlApplicationContext appContext = new
>>ClassPathXmlApplicationContext("replica/server/beans.xml");
>>
>>Listener listener = (Listener)appContext .getBean("serverListener");
>>
>>// Problem! it can't find it .... it seams to have loaded the first
>>file again.
>>
>>// If i use a diferent file name,it works fine.
>>
>>
>>
>>thanks,
>>
>>Pedro.
>>
>>
|