This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring context files

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic