File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Spring context files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring context files" Watch "Spring context files" New topic
Author

Spring context files

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Hi.
I have a question about Spring context files.
After checking some examples, I found that these files named like :
rentABike-context , rentABike-servlet, dataAccessContext-local, dataAccessContext-jta ...
So, is there any required schema for this ?
(like JBoss use -ds , -service ...).
One more question, I found a web application that uses Spring, this application uses the following file : rentABike-servlet.xml
But in the code, there is lines like : ClassPathXmlApplicationContext -and the others flavores-.
How could this thing happened ?
Thanks.
Michael Duffy
Ranch Hand

Joined: Oct 15, 2005
Posts: 163
Originally posted by John Todd:
Hi.
I have a question about Spring context files.
After checking some examples, I found that these files named like :
rentABike-context , rentABike-servlet, dataAccessContext-local, dataAccessContext-jta ...
So, is there any required schema for this ?
(like JBoss use -ds , -service ...).
One more question, I found a web application that uses Spring, this application uses the following file : rentABike-servlet.xml
But in the code, there is lines like : ClassPathXmlApplicationContext -and the others flavores-.
How could this thing happened ?
Thanks.


No required scheme. You can put them all in one big app context file if you like. My preference is to break them up by package. It keeps the size of the context XML files down, and makes the code in the package portable.

How could what have happened?

Reading the context from the CLASSPATH seems like the right thing to do for a Web app. (It works even if the app is deployed in a WAR file.)

What's the problem?


%
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Well, yes, but I mean there is no explicit loading using Spring
ApplicationContext or BeanFactory.
[qoute]
My preference is to break them up by package.
[/qoute]
Hmmm, it seems to me that I don't know anything about this.
Would you mind telling me more about this technique ?
After checking samples dir of Spring distribution, I found files like :
applicationContext-hibernate, applicationContext-toplink, petclinic-servlet, ...
Well, please correct me if I'm wrong :
applicationContext-hibernate is used to inject dependencies for classes that use Hibernate, petclinic-servlet inject dependencies for the servlets.
Right ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring context files
 
Similar Threads
ClassPathXmlApplicationContext wildcard problem
Connecting to two schemas using hibernate
Injecting a Dependency through Spring
How to put configuration files of Spring, JPA and log4j outside jar in standalone app?
Unable to run Spring DHB examples