Anchor |
---|
| override default context |
---|
| override default context |
---|
|
How to override for the default test application contextThe following code fragment illustrates how to override the default test application conxtext: Code Block |
---|
import org.springframework.test.context.ContextConfiguration;
import edu.mit.csf.test.AbstractIntegrationTestBase;
@ContextConfiguration(locations = {"classpath:applicationContext-special-authorization-test.xml"})
public class TestHibernateAcademicTermDao extends AbstractIntegrationTestBase {
}
|
This applicationContext-special-authorization-test.xml must also exist in the project's src/test/resources directory. The contents of this This xml file will contain a list of imports of application context xml files. For example, the contents of this xml file might look like: Code Block |
---|
<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<import resource="classpath*:applicationContext-special-setup.xml" />
<import resource="classpath*:applicationContext-csf-webservices.xml" />
<import resource="classpath*:applicationContext-csf-common.xml" />
<import resource="classpath*:applicationContext-special-authorizations.xml" />
<import resource="classpath*:applicationContext-general-config-test.xml" />
</beans>
|
|