command line parameters in RCP-application?
I'm launching the my Spring RCP-application by following method and it works otherwise properly but ... I'm not able to use any of the command line arguments (args array). So the question goes: How do I set the command line parameters in my application?
public class Main {
public static void main(String[] args) {
String startupContext = ...;
String richclientApplicationContext = ...;
String applicationContext = ...;
new ApplicationLauncher(startupContext, new String[] {richclientApplicationContext, applicationContext});
}
I don't wan't to use the beans/properties in
Using a different BeanPostProcessors depending on the args[]?
I am not sure what you are trying to do with your paramaters, however one of the most usefull things is you can configure spring depending on the args passed in. Like this:
Code:
public class Main {
public static void main(String[] args) {
//do arg check...
String mode = args[0];
ConfigurableBeanFactory bf = new .....; // create BeanFactory
... // now register some beans
// now register any needed BeanPostProcessors
MyBeanPostProcessor pp = new MyBeanPostProcessor();
bf.addBeanPostProcessor(pp);
// now start using the factory
}
http://www.springframework.org/docs/...ry-customizing
construct the applicationContext, then richclient...
Have you tried:
Code:
String[] contextFiles = new String[]
{ root + "richclient-application-context.xml", root + "richclient-preference-context.xml" };
Launcher.setMessage("Initializing datawarehouse...");
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(contextFiles);
// create placeholderconfigurer to bring in some property
// values from a Properties file
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.setLocation(new FileSystemResource("jdbc.properties"));
// now actually do the replacement
cfg.postProcessBeanFactory(factory);
Launcher.setMessage("Initializing gui components and services...");
ApplicationLauncher launcher = new ApplicationLauncher(context);
This will do the trick, before rich-client was constructing the beans before you binded the postProcessBeanFactory