aspose file tools*
The moose likes Struts and the fly likes Spring question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Spring question" Watch "Spring question" New topic
Author

Spring question

vasu maj
Ranch Hand

Joined: Jul 12, 2001
Posts: 395
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


What a wonderful world!
Matt Raible
author
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
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.


Matt<br /> <br />Author: <a href="http://springlive.com" target="_blank" rel="nofollow">Spring Live</a> and <a href="http://www.apress.com/book/bookDisplay.html?bID=256" target="_blank" rel="nofollow">Pro JSP</a><br />Weblogs: <a href="http://raibledesigns.com" target="_blank" rel="nofollow">Raible Designs</a> <a href="http://jroller.com/page/raible" target="_blank" rel="nofollow">Spring Live Blog</a>
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Or you can take a look at JConfig

./pope


blog - InfoQ.com
vasu maj
Ranch Hand

Joined: Jul 12, 2001
Posts: 395
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
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
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

Joined: Jul 12, 2001
Posts: 395
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring question