This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Spring and the fly likes using spring to develop java library, needed best practise for configuration? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "using spring to develop java library, needed best practise for configuration?" Watch "using spring to develop java library, needed best practise for configuration?" New topic
Author

using spring to develop java library, needed best practise for configuration?

Pratap koritala
Ranch Hand

Joined: Sep 27, 2006
Posts: 252
Hi,

I am using spring to develop a java library which will be plugged in to our other projects.

So, there is some dependency (even after annotations used) which will go in an XML file.

Now, I can load this xml from inside packaged jar, But it would be different spring context . Ideally,it should be in the same spring context created by application which uses this JAR.

To be in the same spring context,whoever uses this JAR library file needs to include this XML content in their own spring configuration XML file.

It doesn't seem a best practice to include configuration of JAR file in Application.

Any Ideas???
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

If you're using something like org.springframework.context.support.ClassPathXmlApplicationContext, the context should be the same.


[My Blog]
All roads lead to JavaRanch
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you have a default configuration it's fine (IMO); it can always be overridden by the project using your library.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using spring to develop java library, needed best practise for configuration?
 
Similar Threads
Spring + MVC pattern in non-web application
JSP MVC JDBC
How to put configuration files of Spring, JPA and log4j outside jar in standalone app?
maven2 building a spring web application
Spring application context