Merge branch '1.5.x'

pull/7946/head
Andy Wilkinson 8 years ago
commit 78a06c3278

@ -41,22 +41,20 @@ public class InMemoryRichGaugeRepository implements RichGaugeRepository {
@Override @Override
public void set(Metric<?> metric) { public void set(Metric<?> metric) {
final String name = metric.getName(); final String name = metric.getName();
final double value = metric.getValue().doubleValue(); final double value = metric.getValue().doubleValue();
this.repository.update(name, new Callback<RichGauge>() { this.repository.update(name, new Callback<RichGauge>() {
@Override @Override
public RichGauge modify(RichGauge current) { public RichGauge modify(RichGauge current) {
if (current == null) { if (current == null) {
current = new RichGauge(name, value); return new RichGauge(name, value);
}
else {
current.set(value);
} }
current.set(value);
return current; return current;
} }
});
});
} }
@Override @Override

@ -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

@ -115,7 +115,7 @@ public abstract class AbstractEmbeddedServletContainerFactory
private File getCommonDocumentRoot() { private File getCommonDocumentRoot() {
for (String commonDocRoot : COMMON_DOC_ROOTS) { for (String commonDocRoot : COMMON_DOC_ROOTS) {
File root = new File(commonDocRoot); File root = new File(commonDocRoot);
if (root != null && root.exists() && root.isDirectory()) { if (root.exists() && root.isDirectory()) {
return root.getAbsoluteFile(); return root.getAbsoluteFile();
} }
} }

@ -46,35 +46,28 @@ public class TomcatEmbeddedWebappClassLoader extends WebappClassLoader {
@Override @Override
public synchronized Class<?> loadClass(String name, boolean resolve) public synchronized Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException { throws ClassNotFoundException {
Class<?> resultClass = null; Class<?> result = findExistingLoadedClass(name);
result = (result == null ? doLoadClass(name) : result);
if (result == null) {
throw new ClassNotFoundException(name);
}
return resolveIfNecessary(result, resolve);
}
// Check local class caches private Class<?> findExistingLoadedClass(String name) {
resultClass = (resultClass == null ? findLoadedClass0(name) : resultClass); Class<?> resultClass = findLoadedClass0(name);
resultClass = (resultClass == null ? findLoadedClass(name) : resultClass); resultClass = (resultClass == null ? findLoadedClass(name) : resultClass);
if (resultClass != null) { return resultClass;
return resolveIfNecessary(resultClass, resolve); }
}
// Check security private Class<?> doLoadClass(String name) throws ClassNotFoundException {
checkPackageAccess(name); checkPackageAccess(name);
if ((this.delegate || filter(name, true))) {
// Perform the actual load Class<?> result = loadFromParent(name);
boolean delegateLoad = (this.delegate || filter(name, true)); return (result == null ? findClassIgnoringNotFound(name) : result);
if (delegateLoad) {
resultClass = (resultClass == null ? loadFromParent(name) : resultClass);
}
resultClass = (resultClass == null ? findClassIgnoringNotFound(name)
: resultClass);
if (!delegateLoad) {
resultClass = (resultClass == null ? loadFromParent(name) : resultClass);
}
if (resultClass == null) {
throw new ClassNotFoundException(name);
} }
Class<?> result = findClassIgnoringNotFound(name);
return resolveIfNecessary(resultClass, resolve); return (result == null ? loadFromParent(name) : result);
} }
private Class<?> resolveIfNecessary(Class<?> resultClass, boolean resolve) { private Class<?> resolveIfNecessary(Class<?> resultClass, boolean resolve) {

Loading…
Cancel
Save