| Author |
Spring context files
|
Hussein Baghdadi
clojure forum advocate
Bartender
Joined: Nov 08, 2003
Posts: 3399
|
|
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: 3399
|
|
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 ?
|
 |
 |
|
|
subject: Spring context files
|
|
|