Enable Neo4J's open in view interceptor by default

Closes gh-7943
pull/7873/merge
Andy Wilkinson 8 years ago
parent 9159c87bf9
commit 65025d8dab

@ -120,7 +120,7 @@ public class Neo4jDataAutoConfiguration {
@ConditionalOnClass({ WebMvcConfigurerAdapter.class, @ConditionalOnClass({ WebMvcConfigurerAdapter.class,
OpenSessionInViewInterceptor.class }) OpenSessionInViewInterceptor.class })
@ConditionalOnMissingBean(OpenSessionInViewInterceptor.class) @ConditionalOnMissingBean(OpenSessionInViewInterceptor.class)
@ConditionalOnProperty(prefix = "spring.data.neo4j", name = "open-in-view", havingValue = "true") @ConditionalOnProperty(prefix = "spring.data.neo4j", name = "open-in-view", havingValue = "true", matchIfMissing = true)
protected static class Neo4jWebConfiguration { protected static class Neo4jWebConfiguration {
@Configuration @Configuration

@ -78,7 +78,7 @@ public class Neo4jDataAutoConfigurationTests {
assertThat(this.context.getBeansOfType(Neo4jOperations.class)).hasSize(1); assertThat(this.context.getBeansOfType(Neo4jOperations.class)).hasSize(1);
assertThat(this.context.getBeansOfType(Neo4jTransactionManager.class)).hasSize(1); assertThat(this.context.getBeansOfType(Neo4jTransactionManager.class)).hasSize(1);
assertThat(this.context.getBeansOfType(OpenSessionInViewInterceptor.class)) assertThat(this.context.getBeansOfType(OpenSessionInViewInterceptor.class))
.isEmpty(); .hasSize(1);
} }
@Test @Test
@ -131,10 +131,10 @@ public class Neo4jDataAutoConfigurationTests {
} }
@Test @Test
public void openSessionInViewInterceptorCanBeEnabled() { public void openSessionInViewInterceptorCanBeDisabled() {
load(null, "spring.data.neo4j.open-in-view=true"); load(null, "spring.data.neo4j.open-in-view:false");
assertThat(this.context.getBeansOfType(OpenSessionInViewInterceptor.class)) assertThat(this.context.getBeansOfType(OpenSessionInViewInterceptor.class))
.hasSize(1); .isEmpty();
} }
@Test @Test

Loading…
Cancel
Save