Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6091589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:20:43+00:00 2026-05-23T12:20:43+00:00

I am using Spring Web MVC as frontend on hibernate with transactions (all annotation

  • 0

I am using Spring Web MVC as frontend on hibernate with transactions (all annotation driven). I setup web.xml as follows:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<display-name>wdman</display-name>

<session-config>
    <session-timeout>30</session-timeout>
</session-config>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
    <servlet-name>wdman</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>wdman</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<!-- Disables Servlet Container welcome file handling.
     Needed for compatibility with Servlet 3.0 and Tomcat 7.0 -->
<welcome-file-list>
    <welcome-file></welcome-file>
</welcome-file-list>    

</web-app>

I don’t understand how are options like <tx:annotation-driven/> inherited from root context (in this case the one defined applicationContext.xml) to *-servlet.xml context. It doesn’t seem to function. I have component-scan in both of these files in order to get application working. Is that ok? Aren’t the components duplicated?

Could you help or point me out to some concise documentation describing how these context are merged?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:20:44+00:00Added an answer on May 23, 2026 at 12:20 pm

    I don’t understand how are options like <tx:annotation-driven/> inherited from root context (in this case the one defined applicationContext.xml) to *-servlet.xml context

    They aren’t. These settings are local to the context.

    I have component-scan in both of these files in order to get application working. Is that ok? Aren’t the components duplicated?

    If you have identical component-scan config in each context, then yes, the components will be duplicated. It’s up to you to specify the scan to only instantiate the components that are necessary for each context.

    However, the beans defined in applicationContext.xml are visible to the child context, so you should be able to keep your component-scan in the parent context, and leave it out of the child context. As a rule of thumb, only MVC-specific stuff needs declaring in the servlet context, and those beans can refer to the beans defined in the parent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I've got a simple web application using Spring MVC + Hibernate and am
I am using Spring Web MVC and Hibernate for developing my application. My login.jsp
I'm building a MVC web application (using the Spring MVC framework), and I'm a
I am using Spring MVC to build my web application, and I have a
Almost every new Java-web-project is using a modern MVC-framework such as Struts or Spring
I'm writing a web application using Spring/Hibernate that displays a report to a user,
I'm working on a Java web application (Adobe Flex front-end, JPA/Hibernate/BlazeDS/Spring MVC backend) and
I am using spring web mvc for my app's UI part.. By using following
I am using Spring Web MVC for my application. I have 1 dropdown list
I am developing my application using spring-web-mvc... Now at my Controller it returns like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.