Skip to content

Instantly share code, notes, and snippets.

@odrotbohm
Created October 31, 2012 10:54
Show Gist options
  • Save odrotbohm/3986414 to your computer and use it in GitHub Desktop.
Save odrotbohm/3986414 to your computer and use it in GitHub Desktop.
Using JavaConfig and XML configuration in Spring integration tests
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class MyTest {
@Configuration
@ImportResource("classpath:META-INF/spring/application-context.xml")
static class Config {
// JavaConfig goes here
}
// Tests go here
}
@zygimantus
Copy link

It is working for resources in test directory or main? Because I got this error:

Caused by: java.io.FileNotFoundException: class path resource [WEB-INF/applicationContext.xml] cannot be opened because it does not exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment