• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring question

 
Ranch Hand
Posts: 398
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My spring application uses an xml file for lookup of datasources. It has all the datasource related entries in each of the datasource entries ( URL, Port No, User Name, password etc). Now we need to take out the login details form out of the file and maintain in a different file. How can I do that? The new file has only the entries of login and password for all the datasources.



Thanks,

vasu
 
author
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The XML you've posted looks like it's your datasource configuration for Tomcat, rather than for Spring. If you're configuring a datasource in one of Spring's context files, you can use a PropertyPlaceholderConfigurer to externalize settings into a properties file.

Read More

I can't think of a way to do this for Tomcat.
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or you can take a look at JConfig

./pope
 
vasu maj
Ranch Hand
Posts: 398
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Matt,

This application runs in Spring framework with Hessian used for remote calls.

We are still following the database look up just the way I have posted above. Are you suggesting that I should replace it with a spring context file instead where I have better management of individual properties? IS there no way of doing it leaving it in the tomcat as it is?


Thanks,

Vasu
 
Matt Raible
author
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vasu maj:
Matt,

This application runs in Spring framework with Hessian used for remote calls.

We are still following the database look up just the way I have posted above. Are you suggesting that I should replace it with a spring context file instead where I have better management of individual properties? IS there no way of doing it leaving it in the tomcat as it is?



Yes. If you want to put your settings in another file, then I'd suggest you move your database settings into a spring context file. You mentioned that you don't want to keep these settings in a Tomcat context file. Unless there's a way to do it in Tomcat - putting these settings in a Spring context file seems like a reasonable solution.

You could then use the
PropertyPlaceHolderConfigurer class to move database driver, url, username and password settings into a properties file. Learn More...
 
vasu maj
Ranch Hand
Posts: 398
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am already using spring framework's database access classes which are really very convenient. I will create the context file and move the databse enrties there.

Thanks very much. Very glad that you are here when I needed the help.

Vasu
 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic