Mar 24th, 2006, 12:34 AM
Obtaining user information prior to main window startup
I am in a position where I would like to prompt the user for some information before creating the bulk of my beans. For example, the username and password for connecting to a datasource.
Once I have that information, I can then go ahead and create the rest of the beans that my app needs. I do not anticipate changing the datasource during the lifetime of my app, so "reload" functionality is not required.
However, if there is a clean way of destroying and recreating the various beans when the datasource changes, that would be an option to consider.
What would the "best practice" approach to something like this be? For the moment, I have simply hard-coded the parameters for my datasource in the context.xml file.
Mar 24th, 2006, 05:26 AM
I have a datasource in my application that is injected into my dao layer. However the application starts up without asking for any bean that depends on the datasource. That give me a chance to "initalize" a few things before the first task is executed that fires up a wiring of a DAO and its datasource. This i have found works nice, starts up real fast too!
Mar 24th, 2006, 06:40 AM
So how do you add the datasource to the BeanFactory?
How do you get the rest of your objects to "know about" your data source?
Do you wire them up manually? Or do you "add" the datasource to the BeanFactory somehow, so that it can wire up the other beans when you ask for them?
Mar 24th, 2006, 07:12 AM
The are injected as usual, however my first view does not have any depends on the datasource. When the datasource is eventually requested it is returned via a FactoryBean. In the FactoryBean I set the connect string.
Originally Posted by rdawes