Commit 0232bef8 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch 'sfw-4.3'

parents 9bf95c42 fa7dfb51
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<snakeyaml.version>1.17</snakeyaml.version> <snakeyaml.version>1.17</snakeyaml.version>
<solr.version>5.3.2</solr.version> <solr.version>5.3.2</solr.version>
<spock.version>1.0-groovy-2.4</spock.version> <spock.version>1.0-groovy-2.4</spock.version>
<spring.version>4.2.5.RELEASE</spring.version> <spring.version>4.3.0.BUILD-SNAPSHOT</spring.version>
<spring-amqp.version>1.6.0.M1</spring-amqp.version> <spring-amqp.version>1.6.0.M1</spring-amqp.version>
<spring-cloud-connectors.version>1.2.1.RELEASE</spring-cloud-connectors.version> <spring-cloud-connectors.version>1.2.1.RELEASE</spring-cloud-connectors.version>
<spring-batch.version>3.0.6.RELEASE</spring-batch.version> <spring-batch.version>3.0.6.RELEASE</spring-batch.version>
......
...@@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicReference; ...@@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import samples.websocket.undertow.client.GreetingService; import samples.websocket.undertow.client.GreetingService;
...@@ -56,6 +57,7 @@ public class SampleWebSocketsApplicationTests { ...@@ -56,6 +57,7 @@ public class SampleWebSocketsApplicationTests {
private int port = 1234; private int port = 1234;
@Test @Test
@Ignore("UNDERTOW-639")
public void echoEndpoint() throws Exception { public void echoEndpoint() throws Exception {
ConfigurableApplicationContext context = new SpringApplicationBuilder( ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
......
...@@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicReference; ...@@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import samples.websocket.undertow.SampleUndertowWebSocketsApplication; import samples.websocket.undertow.SampleUndertowWebSocketsApplication;
...@@ -62,6 +63,7 @@ public class CustomContainerWebSocketsApplicationTests { ...@@ -62,6 +63,7 @@ public class CustomContainerWebSocketsApplicationTests {
private static int PORT = SocketUtils.findAvailableTcpPort(); private static int PORT = SocketUtils.findAvailableTcpPort();
@Test @Test
@Ignore("UNDERTOW-639")
public void echoEndpoint() throws Exception { public void echoEndpoint() throws Exception {
ConfigurableApplicationContext context = new SpringApplicationBuilder( ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class) ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
......
...@@ -21,6 +21,8 @@ import java.util.List; ...@@ -21,6 +21,8 @@ import java.util.List;
import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanCurrentlyInCreationException; import org.springframework.beans.factory.BeanCurrentlyInCreationException;
import org.springframework.beans.factory.InjectionPoint;
import org.springframework.beans.factory.UnsatisfiedDependencyException;
import org.springframework.boot.diagnostics.AbstractFailureAnalyzer; import org.springframework.boot.diagnostics.AbstractFailureAnalyzer;
import org.springframework.boot.diagnostics.FailureAnalysis; import org.springframework.boot.diagnostics.FailureAnalysis;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -34,8 +36,6 @@ import org.springframework.util.StringUtils; ...@@ -34,8 +36,6 @@ import org.springframework.util.StringUtils;
class BeanCurrentlyInCreationFailureAnalyzer class BeanCurrentlyInCreationFailureAnalyzer
extends AbstractFailureAnalyzer<BeanCurrentlyInCreationException> { extends AbstractFailureAnalyzer<BeanCurrentlyInCreationException> {
private static final String FIELD_AUTOWIRING_FAILURE_MESSAGE_PREFIX = "Could not autowire field: ";
@Override @Override
protected FailureAnalysis analyze(Throwable rootFailure, protected FailureAnalysis analyze(Throwable rootFailure,
BeanCurrentlyInCreationException cause) { BeanCurrentlyInCreationException cause) {
...@@ -66,19 +66,18 @@ class BeanCurrentlyInCreationFailureAnalyzer ...@@ -66,19 +66,18 @@ class BeanCurrentlyInCreationFailureAnalyzer
if (StringUtils.hasText(ex.getResourceDescription())) { if (StringUtils.hasText(ex.getResourceDescription())) {
return String.format(" defined in %s", ex.getResourceDescription()); return String.format(" defined in %s", ex.getResourceDescription());
} }
if (causedByFieldAutowiringFailure(ex)) { InjectionPoint failedInjectionPoint = findFailedInjectionPoint(ex);
return String.format(" (field %s)", if (failedInjectionPoint != null && failedInjectionPoint.getField() != null) {
ex.getCause().getMessage().substring( return String.format(" (field %s)", failedInjectionPoint.getField());
FIELD_AUTOWIRING_FAILURE_MESSAGE_PREFIX.length(),
ex.getCause().getMessage().indexOf(";")));
} }
return ""; return "";
} }
private boolean causedByFieldAutowiringFailure(BeanCreationException ex) { private InjectionPoint findFailedInjectionPoint(BeanCreationException ex) {
return ex.getCause() instanceof BeanCreationException && ex.getCause() if (!(ex instanceof UnsatisfiedDependencyException)) {
.getMessage().startsWith(FIELD_AUTOWIRING_FAILURE_MESSAGE_PREFIX); return null;
}
return ((UnsatisfiedDependencyException) ex).getInjectionPoint();
} }
} }
...@@ -57,7 +57,7 @@ public class BeanCurrentlyInCreationFailureAnalyzerTests { ...@@ -57,7 +57,7 @@ public class BeanCurrentlyInCreationFailureAnalyzerTests {
assertThat(analysis.getDescription()).startsWith( assertThat(analysis.getDescription()).startsWith(
"There is a circular dependency between 3 beans in the application context:"); "There is a circular dependency between 3 beans in the application context:");
assertThat(analysis.getDescription()).contains("three defined in " assertThat(analysis.getDescription()).contains("three defined in "
+ CycleWithAutowiredFields.BeanThreeConfiguration.class); + CycleWithAutowiredFields.BeanThreeConfiguration.class.getName());
assertThat(analysis.getDescription()) assertThat(analysis.getDescription())
.contains("one defined in " + CycleWithAutowiredFields.class.getName()); .contains("one defined in " + CycleWithAutowiredFields.class.getName());
assertThat(analysis.getDescription()) assertThat(analysis.getDescription())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment