pull/50/head
Phillip Webb 11 years ago committed by Phillip Webb
parent 021fe45d83
commit 7e3cb50a22

@ -39,28 +39,25 @@ import org.springframework.util.ClassUtils;
public class EmbeddedDatabaseConfiguration {
private static final Map<EmbeddedDatabaseType, String> EMBEDDED_DATABASE_DRIVER_CLASSES;
private static final Map<EmbeddedDatabaseType, String> EMBEDDED_DATABASE_URLS;
private EmbeddedDatabase database;
static {
Map<EmbeddedDatabaseType, String> drivers = new LinkedHashMap<EmbeddedDatabaseType, String>();
drivers.put(EmbeddedDatabaseType.H2, "org.h2.Driver");
drivers.put(EmbeddedDatabaseType.DERBY, "org.apache.derby.jdbc.EmbeddedDriver");
drivers.put(EmbeddedDatabaseType.HSQL, "org.hsqldb.jdbcDriver");
EMBEDDED_DATABASE_DRIVER_CLASSES = drivers;
}
EMBEDDED_DATABASE_DRIVER_CLASSES = new LinkedHashMap<EmbeddedDatabaseType, String>();
EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.H2, "org.h2.Driver");
EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.DERBY,
"org.apache.derby.jdbc.EmbeddedDriver");
EMBEDDED_DATABASE_DRIVER_CLASSES.put(EmbeddedDatabaseType.HSQL,
"org.hsqldb.jdbcDriver");
EMBEDDED_DATABASE_URLS = new LinkedHashMap<EmbeddedDatabaseType, String>();
EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.H2,
"jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1");
EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.DERBY,
"jdbc:derby:memory:testdb;create=true");
EMBEDDED_DATABASE_URLS.put(EmbeddedDatabaseType.HSQL, "jdbc:hsqldb:mem:testdb");
private static final Map<EmbeddedDatabaseType, String> EMBEDDED_DATABASE_URLS;
static {
Map<EmbeddedDatabaseType, String> urls = new LinkedHashMap<EmbeddedDatabaseType, String>();
urls.put(EmbeddedDatabaseType.H2, "jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1");
urls.put(EmbeddedDatabaseType.DERBY, "jdbc:derby:memory:testdb;create=true");
urls.put(EmbeddedDatabaseType.HSQL, "jdbc:hsqldb:mem:testdb");
EMBEDDED_DATABASE_URLS = urls;
}
private EmbeddedDatabase database;
@Bean
public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()

@ -98,6 +98,12 @@ public class WebMvcAutoConfiguration {
}
}
@Bean
@ConditionalOnMissingBean(HiddenHttpMethodFilter.class)
public HiddenHttpMethodFilter hiddenHttpMethodFilter() {
return new HiddenHttpMethodFilter();
}
// Defined as a nested config to ensure WebMvcConfigurerAdapter it not read when not
// on the classpath
@EnableWebMvc
@ -111,24 +117,24 @@ public class WebMvcAutoConfiguration {
@Autowired
private ResourceLoader resourceLoader;
@Bean
@ConditionalOnBean(View.class)
@ConditionalOnMissingBean(InternalResourceViewResolver.class)
@Bean
public InternalResourceViewResolver defaultViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
return resolver;
}
@ConditionalOnBean(View.class)
@Bean
@ConditionalOnBean(View.class)
public BeanNameViewResolver beanNameViewResolver() {
BeanNameViewResolver resolver = new BeanNameViewResolver();
resolver.setOrder(0);
return resolver;
}
@ConditionalOnBean(View.class)
@Bean
@ConditionalOnBean(View.class)
public ContentNegotiatingViewResolver viewResolver(BeanFactory beanFactory) {
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
resolver.setContentNegotiationManager(beanFactory
@ -211,12 +217,7 @@ public class WebMvcAutoConfiguration {
return requestHandler;
}
}
}
@Bean
@ConditionalOnMissingBean(HiddenHttpMethodFilter.class)
public HiddenHttpMethodFilter hiddenHttpMethodFilter() {
return new HiddenHttpMethodFilter();
}
}

Loading…
Cancel
Save