Set prefix for imported Spring XML resources

I have a Spring application context file that imports several other resources. However some of the resources in the imported files have similar names for example include1.xml has something like

<bean id="MyBean" class="...">

The same bean id is used in include2.xml. Is there a way to set a prefix to the included beans or is there a way so restrict the scope of the included resource. For example something like.

<import resource="include1.xml" prefix="foo"/>
<import resource="include2.xml" prefix="bar"/>

Now in the parent file I can refer to foo.MyBean and bar.MyBean. If no such system exists is there any way to restrict scope so there is no bean id collisions, what is the best practice here?


No, there is no way to namespace the beans based on a file(beans defined later with the same name will override the one's defined earlier) however, you have the freedom to give them your own "name" - so potentially you can name all beans in your foo file:

<bean name="foo.bean1" class=../>
<bean name="foo.bean2" class=../>

and in your bar file, thus namespacing them manually:

<bean name="bar.bean1" class=../>
<bean name="bar.bean2" class=../>

Need Your Help

Visual Studio MSI Installer - Not making registry changes

visual-studio visual-studio-2013 windows-installer

I created a Visual Studio MSI Project that runs an custom EXE (which is good). In this exe, there is some code to add additional registry changes to add entries into Internet Options (mainly Local

javascript setUTCMilliseconds is wrong? Otherwise, I'm wrong

javascript date utc milliseconds

Am I implementing setUTCMilliseconds incorrectly? I get the incorrect date for any value I put in. Here is just one example of a wrong value. All my test data resolves to May 24 (the future from no...