Announcement Announcement Module
No announcement yet.
application context path resolution problems Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • application context path resolution problems

    My test class has trouble resolving things referenced inside the app context when loading the context via the method getConfigLocations(). My class extends AbstractDependencyInjectionSpringContextTests.

    protected String[] getConfigLocations()
    return new String[] {
    "classpath*:bookOfBusinessContext.xml" };

    It can find these files on the classpath, but has trouble resolving the paths to things like simple properties defined inside applicationContext.xml like this:

    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations">

    The first error happens when a bean that references something can't find it because it doesn't exist.

    I've copied the context files to the test directories, modifed them there for testing and it can load everything just fine. But since the original locations work fine at compile time and runtime, why do they not work when running this test?
    It would be best if we have one set of app contexts for the app, and not a special version just for testing.

  • #2
    You obviously need to ensure that where ever the tests are run from is the parent of WEB-INF. Otherwise why can't you use a similar technique to how the applicationContext files are loaded.