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

  • SEARCH
  • Home
  • 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 7050615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:09:54+00:00 2026-05-28T03:09:54+00:00

I have been reading: http://static.springsource.org/spring/docs/2.5.x/reference/resources.html But am having difficulty understanding how to specify classpath

  • 0

I have been reading:

http://static.springsource.org/spring/docs/2.5.x/reference/resources.html

But am having difficulty understanding how to specify classpath resource paths. For example I have a project structure as follows in an eclipse spring project:

project1
  src
    main
       resources
               maincontext.xml
    test      
       resources
               testcontext.xml
       java
           uk
             co
               project1
                      Unittest.java

Then in my testfile I have:

@ContextConfiguration(locations={"classpath:testcontext.xml", "classpath:<path of maincontext>"})

public class BlacklistTest extends AbstractTransactionalJUnit4SpringContextTests{

When I right click on my test file and select debug as JUnit test, the testcontext.xml is found fine. This makes me think the root of my classpath is “project1/src/test/resources”. I do not understand where this is determined in eclipse..? Furthermore once I have done this, how do I include maincontext.xml if it is above my root? And finally if I included another project ‘project 2’ and wanted to add a spring context file from it, how do I reference that in my unittest.java file.

  • 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-28T03:09:54+00:00Added an answer on May 28, 2026 at 3:09 am

    The “root” of your classpath is, literally, "" (an empty string, consider it like a "/" on a filesystem).

    It looks like you’re using Maven. This means that things like /src/main/java, /src/main/resources, etc. get merged during the build process–in other words, Eclipse uses each as a source directory. The test hierarchy follows suit.

    You don’t want to include something that is “above” your root–IMO stick to classpath resources. If you don’t, you must name it explicitly, leave off the "classpath:" prefix, since it isn’t on the classpath, and provide a fully-qualified path (or as fully-qualified as your environment requires, for example, a web-app filename may be based off of the web context root, like "/WEB-INF/foo-context.xml").

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

Sidebar

Related Questions

I've been playing around with prototypal inheritance after reading http://javascript.crockford.com/prototypal.html and having a bit
I have been reading an article about C++ interfaces ( http://accu.org/index.php/journals/233 ) and I
I have been reading up on multiple PHP frameworks, especially the Zend Framework but
I have been reading the docs and playing with different EventQuery parameters for days
I have been reading SO for some time now, but I truly cannot find
I have been reading these forums for some time, but this is my first
I have been reading the API and documentation ( http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Analysis.doc.html 9.5 Edge Detection) and
I have been reading this post on the codeigniter forum, http://codeigniter.com/forums/viewthread/174928/ and it has
I have been reading up on web-site performance lately and along side lowering HTTP-Requests
I have been reading this link from Steven Sanderson about mobile web development http://www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application

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.