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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:53:54+00:00 2026-05-31T00:53:54+00:00

Is there a way of getting JUnit tests in Eclipse (specifically I’m using SpringJUnit4ClassRunner

  • 0

Is there a way of getting JUnit tests in Eclipse (specifically I’m using SpringJUnit4ClassRunner) to use resources from src/main/resources as well as src/test/resources?

Maven’s surefire plugin does this, but running one particular unit test from Eclipse does not.

I’ve got a load of Spring config in src/main/resources/spring-config/ and I want to ‘override’ two specific files. I’ve placed these test-specific overrides in src/test/resources/spring-config/, and when running unit tests through Maven eveerything works. When I run a JUnit test from Eclipse, only the test files are available, and unsurprisingly my context fails to load.

Update

Is appears the Spring classes that configure the test context can’t find the resources from src/main/resources/ when using a wildcard, but will find them if I specify them explicitly.

Doesn’t find things from src/main/resources/

@ContextConfiguration(locations = {"classpath:/spring-config/*.xml"})

Does find specified files from src/main/resources/

@ContextConfiguration(locations = {"classpath:/spring-config/*.xml",
                                   "classpath:/spring-config/app-aws.xml"})
  • 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-31T00:53:56+00:00Added an answer on May 31, 2026 at 12:53 am

    This is actually a limitation of Spring, rather than JUnit. See http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/resources.html#resources-wildcards-in-path-other-stuff for details.

    The solution is to place your Spring config files in a package rather than in the root package.

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

Sidebar

Related Questions

Is there a way of getting the websites absolute URL ( http://www.domain.com/ ) using
Using the Facebook API, is there a way of getting a friend's phone/cell number?
Is there any way of getting a key value from an NSDictionary based on
Is there any way of getting the weather forecast from woeid in javascript? I
Is there any specific way of getting client's date and time without using any
Is there a way of getting the height for a row from the NSIndexPath
Is there a way of getting jQuery to generate breadcrumbs on a page from
Is there a way for getting and using an existing (open) transaction ? I
Is there an elegant way of getting a single result from an SQLite SELECT
Is there a way of getting the assembly name from a namespace string? Eg,

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.