Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class HeapDumpWebEndpointAutoConfigurationTests {

@Test
void runShouldCreateIndicator() {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(HeapDumpWebEndpoint.class));
this.contextRunner.withPropertyValues("management.endpoint.heapdump.access:UNRESTRICTED")
.run((context) -> assertThat(context).hasSingleBean(HeapDumpWebEndpoint.class));
}

@Test
void runWhenDisabledShouldNotCreateIndicator() {
this.contextRunner.withPropertyValues("management.endpoint.heapdump.enabled:false")
.run((context) -> assertThat(context).doesNotHaveBean(HeapDumpWebEndpoint.class));
this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean(HeapDumpWebEndpoint.class));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.springframework.restdocs.cli.CliDocumentation;
import org.springframework.restdocs.cli.CurlRequestSnippet;
import org.springframework.restdocs.operation.Operation;
import org.springframework.test.context.TestPropertySource;
import org.springframework.util.FileCopyUtils;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -40,6 +41,7 @@
*
* @author Andy Wilkinson
*/
@TestPropertySource(properties = "management.endpoint.heapdump.access=unrestricted")
class HeapDumpWebEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.boot.actuate.endpoint.Access;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
Expand All @@ -56,7 +57,7 @@
* @author Andy Wilkinson
* @since 2.0.0
*/
@WebEndpoint(id = "heapdump")
@WebEndpoint(id = "heapdump", defaultAccess = Access.NONE)
public class HeapDumpWebEndpoint {

private final long timeout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ If your application is a web application (Spring MVC, Spring WebFlux, or Jersey)
[[actuator.endpoints.controlling-access]]
== Controlling Access to Endpoints

By default, access to all endpoints except for `shutdown` is unrestricted.
By default, access to all endpoints except for `shutdown` and `heapdump` is unrestricted.
To configure the permitted access to an endpoint, use its `management.endpoint.<id>.access` property.
The following example allows unrestricted access to the `shutdown` endpoint:

Expand Down