parent
701bb6ee0a
commit
03667c7ddc
|
@ -51,11 +51,11 @@ public class CommonsDataSourceConfiguration extends AbstractDataSourceConfigurat
|
|||
public DataSource dataSource() {
|
||||
logger.info("Hint: using Commons DBCP BasicDataSource. It's going to work, "
|
||||
+ "but the Tomcat DataSource is more reliable.");
|
||||
this.pool = createAndSetupPool();
|
||||
this.pool = createAndConfigurePool();
|
||||
return this.pool;
|
||||
}
|
||||
|
||||
private BasicDataSource createAndSetupPool() {
|
||||
private BasicDataSource createAndConfigurePool() {
|
||||
BasicDataSource pool = new BasicDataSource();
|
||||
pool.setDriverClassName(getDriverClassName());
|
||||
pool.setUrl(getUrl());
|
||||
|
|
|
@ -77,7 +77,7 @@ public class SpringApplicationContextLoader extends AbstractContextLoader {
|
|||
List<ApplicationContextInitializer<?>> initializers = getInitializers(
|
||||
mergedConfig, application);
|
||||
if (mergedConfig instanceof WebMergedContextConfiguration) {
|
||||
new WebConfigurer().setup(mergedConfig, application, initializers);
|
||||
new WebConfigurer().configure(mergedConfig, application, initializers);
|
||||
}
|
||||
else {
|
||||
application.setWebEnvironment(false);
|
||||
|
@ -168,20 +168,22 @@ public class SpringApplicationContextLoader extends AbstractContextLoader {
|
|||
}
|
||||
|
||||
private static class WebConfigurer {
|
||||
void setup(MergedContextConfiguration mergedConfig,
|
||||
|
||||
void configure(MergedContextConfiguration configuration,
|
||||
SpringApplication application,
|
||||
List<ApplicationContextInitializer<?>> initializers) {
|
||||
WebMergedContextConfiguration webConfig = (WebMergedContextConfiguration) mergedConfig;
|
||||
if (AnnotationUtils.findAnnotation(webConfig.getTestClass(),
|
||||
WebMergedContextConfiguration webConfiguration = (WebMergedContextConfiguration) configuration;
|
||||
if (AnnotationUtils.findAnnotation(webConfiguration.getTestClass(),
|
||||
IntegrationTest.class) == null) {
|
||||
MockServletContext servletContext = new MockServletContext(
|
||||
webConfig.getResourceBasePath());
|
||||
webConfiguration.getResourceBasePath());
|
||||
initializers.add(0, new ServletContextApplicationContextInitializer(
|
||||
servletContext));
|
||||
application
|
||||
.setApplicationContextClass(GenericWebApplicationContext.class);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue