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 9164537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:42:28+00:00 2026-06-17T14:42:28+00:00

I know that there are several questions on this .. but still I cannot

  • 0

I know that there are several questions on this .. but still I cannot make it work.
I have a spring application for which I’m trying to write integration tests.
I try to setup the application context using an xml file (more or less the same xml file that I’m using for the application).
The problems that appeared are the following:

  1. The configuration was not loaded and I’ve received errors like :”expected single bean but found 0.”

  2. I’ve specified the correct path and then it started to complain about resources that are not found on the classpath. I’ve copied the files that are missing inside the folder test/resources.

  3. Now, it fails to load the application context with this error: No matching bean of type [javax.servlet.http.HttpServletRequest] found for dependency. (In my configuration file I have mvc:annotation-driven />)

  4. I have followed this example http://www.scarba05.co.uk/blog/2010/07/more-on-integration-testing-of-spring%E2%80%99s-mvc-annotation-mapppings-for-controllers/ to make my integration test. Still, when I make the call handlerAdapter.handle(request, response, controller); I receive A ClassCastException because my controller is not an instance of a HandlerAdapter. I almost followed the same error path as the one found here: http://forum.springsource.org/showthread.php?131196-Spring-3-1-2-Controller-annotated-Controllers-JUnit-test-fail.

Yes, I am new to Spring, but at least I’ve searched and read a lot. Could you please point me to a good tutorial or to some sample projects (other than the spring ones) such that I can solve my problem.

Thank you in advance for the time that you spent on reading my question!

  • 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-06-17T14:42:29+00:00Added an answer on June 17, 2026 at 2:42 pm

    I have written a blog post on what I think is the best way to override spring application context for testing. Basically, you should not be copying your main application context xml files for testing, as this leads to duplication, instead just override the parts you need to:

    • http://www.solubris.com/blog/overriding_spring_context_for_testing

    However, this doesn’t include controller tests. For those, the post you mentioned has now been deprecated by the spring-mvc-test project, which is now included in spring 3.2.x

    Here is some reading on spring MVC test framework:

    • http://static.springsource.org/spring-framework/docs/current/spring-framework-reference/html/testing.html#spring-mvc-test-framework
    • http://blog.springsource.org/2012/11/12/spring-framework-3-2-rc1-spring-mvc-test-framework/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are several other posts on this topic but they still leave
I know there have been several questions in the past regarding things that compile
I know, there are several questions of this type but I tried all of
I know that this question have been asked several times. But I can't get
I know that there are some threads have a similar issue with this thread.
I know that there are lot's of questons on this, but all seem to
I know that there are lots of examples out there on this, but they
I know that there are many Delphi database related questions available, but I'm considering
I've read several different questions from SO about this already but still haven't been
I know that there are others posts with solutions on the site but i

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.