Add a shim Endpoint if management context is child

When management endpoints are on a different port the HandlerMappings
are restricted to a single EndpointHandlerMapping, so the error
controller (which is a normal @Controller with @RequestMappings) does
not get mapped.

Fixed by addinga shim Endpoint on "/error" that delegates to the
ErrorController (which interface picks up an extra method).
This commit is contained in:
Dave Syer
2013-12-05 08:46:20 +00:00
parent 25d9ac6535
commit bcae284dd9
6 changed files with 66 additions and 22 deletions

View File

@@ -16,6 +16,8 @@
package org.springframework.boot.sample.ops.ui;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.Callable;
@@ -25,7 +27,6 @@ import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
@@ -35,8 +36,6 @@ import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals;
/**
* Integration tests for separate management and main service ports.
*
@@ -80,9 +79,7 @@ public class SampleActuatorUiApplicationPortTests {
}
@Test
@Ignore
public void testMetrics() throws Exception {
// FIXME broken since error page is not rendered
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = getRestTemplate().getForEntity(
"http://localhost:" + managementPort + "/metrics", Map.class);