I want to laod the spring context file based on the command line. Basically I am going to get the region from the command line and开发者_Python百科 instanciate the beans in the context file based on region. Is there a way to pass the command line param to FileSystemXmlApplicationContext
without maintaining 2 different context files?
Thanks in advance.
Yes, it depends on where exactly you want to load it:
- use
<import resource="${command.line.param}/context.xml" />
in your commonapplicationContext.xml
- use
<param-value>${command.line.param}/applicationContext.xml</param-value>
in your web.xml, in acontext-param
namedcontextConfigLocation
精彩评论