parent
b19403c9fc
commit
3ecbbce773
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.boot.actuate.autoconfigure.endpoint.jackson;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
|
@ -43,6 +44,7 @@ public class JacksonEndpointAutoConfiguration {
|
|||
@ConditionalOnClass({ ObjectMapper.class, Jackson2ObjectMapperBuilder.class })
|
||||
public EndpointObjectMapper endpointObjectMapper() {
|
||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
|
||||
.featuresToEnable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY)
|
||||
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,
|
||||
SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS)
|
||||
.serializationInclusion(Include.NON_NULL)
|
||||
|
|
|
@ -67,7 +67,7 @@ abstract class AbstractManagementPortAndPathSampleActuatorApplicationTests {
|
|||
ResponseEntity<String> entity = new TestRestTemplate().withBasicAuth("user", "password")
|
||||
.getForEntity("http://localhost:" + this.managementPort + "/admin/health", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\",\"groups\":[\"comp\",\"live\",\"ready\"]}");
|
||||
assertThat(entity.getBody()).isEqualTo("{\"groups\":[\"comp\",\"live\",\"ready\"],\"status\":\"UP\"}");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -76,7 +76,7 @@ abstract class AbstractManagementPortAndPathSampleActuatorApplicationTests {
|
|||
.getForEntity("http://localhost:" + this.managementPort + "/admin/health/comp", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(entity.getBody()).contains(
|
||||
"components\":{\"a\":{\"status\":\"UP\",\"details\":{\"hello\":\"spring-a\"}},\"c\":{\"status\":\"UP\",\"details\":{\"hello\":\"spring-c\"}}");
|
||||
"components\":{\"a\":{\"details\":{\"hello\":\"spring-a\"},\"status\":\"UP\"},\"c\":{\"details\":{\"hello\":\"spring-c\"},\"status\":\"UP\"}}");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue