Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

XML files needed for developing using Spring MVC and Hibernate?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the XML files needed for developing an application using Spring MVC and Hibernate
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no answer to your question. What do you exactly mean?

I might have 2 xml files, or I might have 20 xml files in my Spring MVC/Hibernate application. or any number in between.

Mark
 
Gaurav Sandil
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean to say that I have seen some code where they have used applicationContext.xml and DispatcherServlet.xml(usually Servlet name follwed by-servlet.xml) and seen some examples where they used only one.
What are the uses of these two xml files.
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gaurav Sandil wrote:I mean to say that I have seen some code where they have used applicationContext.xml and DispatcherServlet.xml(usually Servlet name follwed by-servlet.xml) and seen some examples where they used only one.
What are the uses of these two xml files.



Cool, that makes more sense.

So with you have xxx-servlet-xml, that typically has just the Web Layer beans.

The applicationContext.xml has the middle tier beans like your services and repositories, as well as importing the xml files that have your infrastructure beans like dataSource and transactionManager.

Each of these files is actually loaded by different classes making two different ApplicationContext instances. One for the middle tier beans and one for the web layer beans which separates them in a good way. The Web Layer will have full access to beans in the middle tier, but not the other way around. But you do not want your middle tier to see any beans from your web layer. You should be able to call down the stack, but not up.

When you have seen it where they only have one file and one loading of the application context, those people are just not separating out the layers. You can do this and everything works, but I personally don't recommend it.

Mark
 
Gaurav Sandil
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Mark..
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic