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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:50:55+00:00 2026-06-01T04:50:55+00:00

I have a Spring JUnit test with configuration files and @ContextConfiguration parameters: package ru.csbi.registry.domain.envers.integration;

  • 0

I have a Spring JUnit test with configuration files and @ContextConfiguration parameters:

package ru.csbi.registry.domain.envers.integration;

import org.hibernate.Transaction;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import ru.csbi.registry.domain.property.Building;
import ru.csbi.registry.utils.PersistenceManagerHibernate;
import ru.csbi.test.catergory.integration.container.IntegrationTestsRequiringBothSpringIoCContainerAndTestDatabaseCategory;

@Category(IntegrationTestsRequiringBothSpringIoCContainerAndTestDatabaseCategory.class)
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {  "app-config.xml",
                                 "mvc-config.xml",
                                 "aop-config.xml",
                                 "ds-config.xml",
                                 "security-acl-config.xml",
                                 "security-authentication-config.xml" })
//@TransactionConfiguration
//@Transactional
//@ActiveProfiles({"dev", "integration"})
public class RegressionTest {

@Autowired
private PersistenceManagerHibernate persistenceManagerHibernate;

/**
 * Regression test for MR-1088.
 */
@Test
public void test() {
    Building building = createBuildingDetachedObject();
    Transaction transaction = persistenceManagerHibernate.getSessionFactory().getCurrentSession().getTransaction();
    transaction.begin();
    persistenceManagerHibernate.save(building);
    transaction.commit();
    Transaction transaction2 = persistenceManagerHibernate.getSessionFactory().getCurrentSession().getTransaction();
    transaction2.begin();
    persistenceManagerHibernate.delete(building);
    transaction2.commit();
}

private Building createBuildingDetachedObject() {
    Building building = new Building();
    building.setId(1L);
    return building;
}
}

Configuration files use properties from *.properties files:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<bean id="servletContext" class="org.springframework.mock.web.MockServletContext" />

<bean id="propertyConfigurer"       class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
    <property name="searchSystemEnvironment" value="true" />
    <property name="locations">
        <list>
            <value>file:/${CSBI_INTEGRATION_TEST}/*.properties</value>
        </list>
    </property>
    <!-- <property name="order" value="0" /> -->
</bean>

<!-- Scans within the base package of the application for @Components to 
    configure as beans -->
<context:component-scan base-package="ru.csbi.registry" />
<!-- Configure the multipart resolver -->
<bean id="multipartResolver"
    class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <!-- one of the properties available; the maximum file size in bytes -->
    <property name="maxUploadSize" value="${upload.maxsize}" />
</bean>

and test execution fails with errors:

 java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
 Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: **Invalid bean definition with name 'multipartResolver' defined in class path resource [ru/csbi/registry/domain/envers/integration/app-config.xml]: Could not resolve placeholder 'upload.maxsize'**
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209)
at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:220)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:84)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:656)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
at org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
... 24 more


Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: **Invalid bean definition with name 'multipartResolver' defined in class path resource [ru/csbi/registry/domain/envers/integration/app-config.xml]: Could not resolve placeholder 'upload.maxsize'**

How to pass parameter upload.maxsize to properties files?

  • 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-01T04:50:57+00:00Added an answer on June 1, 2026 at 4:50 am

    You are using a PropertyPlaceholderConfigurer, which will replace properties it finds in system properties or URLs matching file:/${CSBI_INTEGRATION_TEST}/*.properties. This gives you a couple of options:

    1. Run your test with -Dupload.maxsize=[value here]
    2. Ensure that a properties file in the ${CSBI_INTEGRATION_TEST} directory contains a line upload.maxsize=[value here]

    This file URL looks a bit quirky though- why the single leading / before ${CSBI_INTEGRATION_TEST}?

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

Sidebar

Related Questions

I have a JUnit 4 test case with the Spring @Transactional annotation that saves
In spring/junit you can load application context files using @ContextConfiguration such as @ContextConfiguration({classpath:a.xml, classpath:b.xml})
im using Junit with spring-test and i would like to have a classic transactionnal
I have written a JUnit test for a private function which is returning String.
When i run my spring junit test i got this error message : Caused
I have a suite of system tests that uses Spring's JUnit runner, the database
We have test classes which are built on Spring 2.0.8's AbstractTransactionalDataSourceSpringContextTests. There are a
I am trying to execute a SQL script in my JUnit test using Spring.
I am using Spring and JUnit to write some integration tests for my DAO.
Suppose, I have a junit test class: class MyComponentTest { private void test(File file)

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.