aspose file tools*
The moose likes Spring and the fly likes XML files needed for developing using Spring MVC and Hibernate? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "XML files needed for developing using Spring MVC and Hibernate?" Watch "XML files needed for developing using Spring MVC and Hibernate?" New topic
Author

XML files needed for developing using Spring MVC and Hibernate?

Gaurav Sandil
Greenhorn

Joined: Aug 24, 2008
Posts: 14
What are the XML files needed for developing an application using Spring MVC and Hibernate
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Gaurav Sandil
Greenhorn

Joined: Aug 24, 2008
Posts: 14
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
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

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

Joined: Aug 24, 2008
Posts: 14
Thanks a lot Mark..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML files needed for developing using Spring MVC and Hibernate?