Stop exposing a duplicate web extension for the env endpoint

An actuator endpoint is designed around a single class flagged with
`@Endpoint`. Such endpoint can have some of its operations refined with
a given tech (for instance via a `EndpointWebExtension` for web specific
concerns).

This design mandates that an endpoint (and its tech specific refinements
are managed centrally to form a unified contract).

As Spring Cloud is extending the standard Spring Boot's `env` endpoint,
this commit introduces a WritableEnvironmentEndpoint with a web
extension.

Closes gh-367
Closes gh-354
This commit is contained in:
Stephane Nicoll
2018-05-10 10:02:30 +02:00
committed by Dave Syer
parent 73e233dcd9
commit bf5de108e2
7 changed files with 110 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.context.environment;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.servlet.ServletException;
@@ -44,6 +45,7 @@ import org.springframework.web.context.WebApplicationContext;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -108,6 +110,12 @@ public class EnvironmentManagerIntegrationTests {
assertEquals(0, properties.getDelay());
}
@Test
public void coreWebExtensionAvailable() throws Exception {
this.mvc.perform(get(BASE_PATH + "/env/" + UUID.randomUUID().toString()))
.andExpect(status().isNotFound());
}
@Configuration
@EnableAutoConfiguration
protected static class TestConfiguration {