Enable Neo4J's open in view interceptor by default

Closes gh-7943
This commit is contained in:
Andy Wilkinson 2017-01-10 17:04:19 -05:00
parent 9159c87bf9
commit 65025d8dab
2 changed files with 5 additions and 5 deletions

View File

@ -120,7 +120,7 @@ public class Neo4jDataAutoConfiguration {
@ConditionalOnClass({ WebMvcConfigurerAdapter.class,
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 {
@Configuration

View File

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