Announcement Announcement Module
Collapse
No announcement yet.
Obtaining user information prior to main window startup Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Obtaining user information prior to main window startup

    Hi folks,

    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.

    Many thanks

    Rogan

  • #2
    datasource...

    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!

    Comment


    • #3
      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?

      Thanks

      Rogan

      Comment


      • #4
        FactoryBean

        Originally posted by rdawes
        How do you get the rest of your objects to "know about" your data source?
        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.

        Comment

        Working...
        X