how to initialize database after server has started

in my spring mvc project the way i am currently initializing my database is to define beans in xmls and autowire my dao
 so when the server starts up my dao class is ready to perform data operations.
but i want to do it another way. let the server start and then i initialize my database and dao and use them as before i was using when doing autowiring.

how to implement this ?

Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

what is the motivation for doing this?
Rohit BajajAuthor Commented:
Motivation is the same as in question :
Basically i will be reading the environment variable FLOCK_APPS_CONFIG from a file on linux as i am using a headless linux user on which i cannot set environement variables.
And jetty needs this value before it starts up completely to setup database etc. which i have autowired.

So i was thinking if i can delay the setting up of databases and configure it after the jetty starts by reading from a file that will work. As after jetty has started up i can read from a file i assume easily
normally this sort of thing is done using JNDI lookup.
You would typically configure the datasource JNDI name in the server and use the application to look it up.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.