diff --git a/pom.xml b/pom.xml index b6a82eb309..958a31a8ba 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,6 @@ spring-boot-devtools spring-boot-docs spring-boot-starters - spring-boot-actuator-docs spring-boot-cli diff --git a/spring-boot-actuator-docs/pom.xml b/spring-boot-actuator-docs/pom.xml deleted file mode 100644 index 5ebe8f850c..0000000000 --- a/spring-boot-actuator-docs/pom.xml +++ /dev/null @@ -1,252 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-parent - 2.0.0.BUILD-SNAPSHOT - ../spring-boot-parent - - spring-boot-actuator-docs - Spring Boot Actuator Docs - Spring Boot Actuator Docs - - Pivotal Software, Inc. - http://www.spring.io - - - ${basedir}/.. - - - - - org.springframework.hateoas - spring-hateoas - - - - org.springframework.boot - spring-boot-actuator - provided - - - org.springframework.boot - spring-boot-test - provided - - - org.springframework.boot - spring-boot-test-autoconfigure - provided - - - ch.qos.logback - logback-classic - provided - - - com.h2database - h2 - provided - - - com.jayway.jsonpath - json-path - provided - - - junit - junit - provided - - - org.codehaus.groovy - groovy-templates - provided - - - org.flywaydb - flyway-core - provided - - - org.liquibase - liquibase-core - provided - - - org.springframework - spring-core - - - org.springframework - spring-jdbc - provided - - - org.springframework - spring-test - provided - - - org.springframework.plugin - spring-plugin-core - provided - - - org.springframework.restdocs - spring-restdocs-mockmvc - provided - - - org.yaml - snakeyaml - provided - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-restdoc-source - generate-sources - - add-source - - - - ${basedir}/src/restdoc/java - - - - - add-restdoc-resource - generate-sources - - add-resource - - - - - ${basedir}/src/restdoc/resources - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - ${project.build.outputDirectory} - - **/*Documentation.java - - false - - - - generate-rest-documentation - process-classes - - test - - - - - - org.asciidoctor - asciidoctor-maven-plugin - 1.5.2 - - - generate-docs - prepare-package - - process-asciidoc - - - html - book - index.adoc - - ${project.build.directory}/generated-snippets - ${project.build.directory}/../src/main/asciidoc - - - - - - - maven-resources-plugin - - - copy-resources - prepare-package - - copy-resources - - - ${project.build.outputDirectory}/META-INF/resources/spring-boot-actuator/docs - - - ${project.build.directory}/generated-docs - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - **/*.html - **/*.png - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.maven.plugins - - - maven-surefire-plugin - - - [2.18.1,) - - - test - - - - - - - - - - - - - - diff --git a/spring-boot-actuator-docs/src/main/asciidoc/autoconfig.adoc b/spring-boot-actuator-docs/src/main/asciidoc/autoconfig.adoc deleted file mode 100644 index 8d19eab253..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/autoconfig.adoc +++ /dev/null @@ -1,23 +0,0 @@ -=== /autoconfig -This endpoint is a report on the Spring Boot auto-configuration process that happened when -your application started up. It lists all the `@Conditional` annotations that were -evaluated as the context started and in each case it gives an indication of if (and why) -the condition matched. A positive match results in a bean being included in the context, -and a negative result means the opposite (the bean's class may not even be loaded). - -The report is split into 2 parts, positive matches first, and then negative. If the -context is a hierarchy, there is also a separate report on the parent context with the -same format (and recursively up to the top of the hierarchy). - -NOTE: The report is actually about `@Conditional` evaluation not auto-configuration -per se, but most auto-configuration features use `@Conditional` heavily, so there is a lot -of overlap. - -Example curl request: -include::{generated}/autoconfig/curl-request.adoc[] - -Example HTTP request: [small]##link:../autoconfig[icon:external-link[role="silver"]]## -include::{generated}/autoconfig/http-request.adoc[] - -Example HTTP response: -include::{generated}/autoconfig/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/beans.adoc b/spring-boot-actuator-docs/src/main/asciidoc/beans.adoc deleted file mode 100644 index 3b74df2f49..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/beans.adoc +++ /dev/null @@ -1,14 +0,0 @@ -=== /beans -This endpoint is a report on the Spring Boot `ApplicationContext`. It lists the beans in -the context and their dependencies, detailing the names and concrete classes of each bean. - -NOTE: Some beans are pure configuration (any class that is annotated `@Configuration`). - -Example curl request: -include::{generated}/beans/curl-request.adoc[] - -Example HTTP request: [small]##link:../beans[icon:external-link[role="silver"]]## -include::{generated}/beans/http-request.adoc[] - -Example HTTP response: -include::{generated}/beans/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/configprops.adoc b/spring-boot-actuator-docs/src/main/asciidoc/configprops.adoc deleted file mode 100644 index 20d69bb997..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/configprops.adoc +++ /dev/null @@ -1,16 +0,0 @@ -=== /configprops -This endpoint is a report on the Spring Boot `@ConfigurationProperties` beans. Beans with -this annotation are bound to the `Environment` on startup, so they reflect the -externalised configuration of the application. Beans are listed by name. A bean that is -added using `@EnableConfigurationProperties` will have a conventional name: -`-`, where `` is the environment key prefix specified in the -`@ConfigurationProperties` annotation and the fully qualified name of the bean. - -Example curl request: -include::{generated}/configprops/curl-request.adoc[] - -Example HTTP request: [small]##link:../configprops[icon:external-link[role="silver"]]## -include::{generated}/configprops/http-request.adoc[] - -Example HTTP response: -include::{generated}/configprops/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/dump.adoc b/spring-boot-actuator-docs/src/main/asciidoc/dump.adoc deleted file mode 100644 index cf0a25f8ec..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/dump.adoc +++ /dev/null @@ -1,17 +0,0 @@ -=== /dump -This endpoint is a thread dump: the result is a list of threads each with their name, -monitor state and stack. It is the same information as you would get from `kill -3` of a -running Java process. It can be very useful for detecting issues at runtime, especially -sluggish behaviour caused by threads blocked by slow or unavailable I/O (e.g. if a -connection pool is exhausted). - -NOTE: Some `SecurityManager` implementations might prevent this endpoint from working. - -Example curl request: -include::{generated}/dump/curl-request.adoc[] - -Example HTTP request: [small]##link:../dump[icon:external-link[role="silver"]]## -include::{generated}/dump/http-request.adoc[] - -Example HTTP response: -include::{generated}/dump/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/env.adoc b/spring-boot-actuator-docs/src/main/asciidoc/env.adoc deleted file mode 100644 index bda5fcc303..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/env.adoc +++ /dev/null @@ -1,15 +0,0 @@ -=== /env -This endpoint is a dump of the Spring `Environment`. It lists the active profiles and all -the `PropertySources` in the `Environment` (the ones that are listed first take precedence -when binding to `@ConfigurationProperties` or `@Value`). Normally you will see the Java -`System` properties and the OS environment variables in their own `PropertySources` plus -any `.properties` or `.yml` files used to configure the application on start up. - -Example curl request: -include::{generated}/env/curl-request.adoc[] - -Example HTTP request: [small]##link:../env[icon:external-link[role="silver"]]## -include::{generated}/env/http-request.adoc[] - -Example HTTP response: -include::{generated}/env/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/flyway.adoc b/spring-boot-actuator-docs/src/main/asciidoc/flyway.adoc deleted file mode 100644 index 1aa6447e32..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/flyway.adoc +++ /dev/null @@ -1,12 +0,0 @@ -=== /flyway -This endpoint provides information about database migrations that have been performed -by Flyway. - -Example curl request: -include::{generated}/flyway/curl-request.adoc[] - -Example HTTP request: -include::{generated}/flyway/http-request.adoc[] - -Example HTTP response: -include::{generated}/flyway/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/health.adoc b/spring-boot-actuator-docs/src/main/asciidoc/health.adoc deleted file mode 100644 index d7ad4dc1b7..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/health.adoc +++ /dev/null @@ -1,20 +0,0 @@ -=== /health -This endpoint is an indication of the health of the application. It has an overall status -("UP", "DOWN" etc.), which is the only thing you see unless either you are authenticated -or the endpoint is marked as `sensitive=false` (`endpoints.health.sensitive=false`). - -The HTTP code in the response reflects the status (e.g. "`UP`"=200, -"`OUT_OF_SERVICE`"=503, "`DOWN`"=503). The mappings can be changed by configuring -`endpoints.health.mapping.=XXX`. - -Example curl request: -include::{generated}/health/curl-request.adoc[] - -Example HTTP request: [small]##link:../health[icon:external-link[role="silver"]]## -include::{generated}/health/http-request.adoc[] - -Example HTTP response: -include::{generated}/health/http-response.adoc[] - -Example HTTP response with `endpoints.health.sensitive=false`: -include::{generated}/health/insensitive/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/images/hal-browser.png b/spring-boot-actuator-docs/src/main/asciidoc/images/hal-browser.png deleted file mode 100644 index b43460b9df..0000000000 Binary files a/spring-boot-actuator-docs/src/main/asciidoc/images/hal-browser.png and /dev/null differ diff --git a/spring-boot-actuator-docs/src/main/asciidoc/index.adoc b/spring-boot-actuator-docs/src/main/asciidoc/index.adoc deleted file mode 100644 index 36a01c2d0a..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/index.adoc +++ /dev/null @@ -1,203 +0,0 @@ -= Spring Boot Actuator Endpoints -:toc: left -:idprefix: spring_boot_actuator_ -:sectanchors: -:icons: font -:last-update-label!: - -Actuator endpoints allow you to monitor and interact with your application. Spring Boot -includes a number of built-in endpoints and you can also add your own. For example the -`health` endpoint provides basic application health information. - -The way that endpoints are exposed will depend on the type of technology that you choose. -Most applications choose HTTP monitoring, where the ID of the endpoint is mapped -to a URL. For example, by default, the `health` endpoint will be mapped to `/health`. - - - -== List of Endpoints -include::{generated}/endpoints.adoc[] - - - -=== /auditevents -This endpoint provides information about audit events registered by the application. -Audit events can be filtered using the `after`, `principal` and `type` parameters as -defined by `AuditEventRepository`. - -Example cURL request with `after` parameter: -include::{generated}/auditevents/curl-request.adoc[] - -Example HTTP request with `after` parameter: -include::{generated}/auditevents/http-request.adoc[] - -Example HTTP response: -include::{generated}/auditevents/http-response.adoc[] - -Example cURL request with `principal` and `after` parameters: -include::{generated}/auditevents/filter-by-principal/curl-request.adoc[] - -Example HTTP request with `principal` and `after` parameters: -include::{generated}/auditevents/filter-by-principal/http-request.adoc[] - -Example cURL request with `principal`, `after` and `type` parameters: -include::{generated}/auditevents/filter-by-principal-and-type/curl-request.adoc[] - -Example HTTP request with `principal`, `after` and `type` parameters: -include::{generated}/auditevents/filter-by-principal-and-type/http-request.adoc[] - - - -=== /logfile -This endpoint (if available) contains the plain text logfile configured by the user -using `logging.file` or `logging.path` (by default logs are only emitted on stdout -so one of these properties has to be set for this endpoint to be active). - -Example curl request: -include::{generated}/logfile/curl-request.adoc[] - -Example HTTP request: [small]##link:../logfile[icon:external-link[role="silver"]]## -include::{generated}/logfile/http-request.adoc[] - -Example HTTP response: -include::{generated}/logfile/http-response.adoc[] - -==== Partial content - -You can use the `Range` header to retrieve part of the log file's content. - -Example curl request: -include::{generated}/partial-logfile/curl-request.adoc[] - -Example HTTP request: -include::{generated}/partial-logfile/http-request.adoc[] - -Example HTTP response: -include::{generated}/partial-logfile/http-response.adoc[] - - - -=== /docs -This endpoint (if available) contains HTML documentation for the other endpoints. Its path -can be "/docs" (if there is an existing home page) or "/" (otherwise, including if the -HAL browser is not active). - - - -== Hypermedia Support -If `endpoints.hypermedia.enabled` is set to `true` and -https://projects.spring.io/spring-hateoas[Spring HATEOAS] is on the classpath (e.g. -through the `spring-boot-starter-hateoas` or if you are using -http://projects.spring.io/spring-data-rest[Spring Data REST]) then the Actuator endpoint -responses are enhanced with hypermedia in the form of "links". The default media type for -responses is http://stateless.co/hal_specification.html[HAL], resulting in each resource -having an extra property called "_links". You can change the media type to another one -supported by Spring HATEOAS by providing your own `@EnableHypermedia` annotation and -custom providers as necessary. - -Example enhanced "/metrics" endpoint with additional "_links": - -include::{generated}/metrics/hypermedia/http-response.adoc[] - -WARNING: Beware of Actuator endpoint paths clashing with application endpoints. -The easiest way to avoid that is to use a `management.context-path`, e.g. "/admin". - -TIP: You can disable the hypermedia support in Actuator endpoints by setting -`endpoints.actuator.enabled=false`. - - - -=== Main entry point -When the hypermedia support is enabled, the Actuator provides a main entry point that -provides links to all of its endpoints. If `management.context-path` is empty, this entry -point is available at `/actuator`. If a management context path has been configured then -the entry point is available at the root of that context. For example, if -`management.context-path` has been set to `/admin` then the main entry point will be -available at `/admin`. - -TIP: The endpoint path can always, as with all MVC endpoints, be overridden using -`endpoints.actuator.path=/yourpath` (note the leading slash). - -include::{generated}/admin/http-response.adoc[] - - - -=== Endpoints with format changes -Some endpoints in their "`raw`" form consist of an array (e.g. the `/beans` and the -`/trace` endpoints). These need to be converted to objects (maps) before they can be -enhanced with links, so their contents are inserted as a field named "`content`". -Example enhanced `/beans` endpoint with additional `_links`: - -include::{generated}/beans/hypermedia/http-response.adoc[] - - - -== HAL Browser -If Hypermedia is enabled and the HAL format is in use (which is the default), then you -can provide a browser for the resources by including a dependency on the -https://github.com/mikekelly/hal-browser[HAL browser] webjar. - -For example in Maven: - -[source,xml,indent=0] ----- - - org.webjars - hal-browser - ----- - - -or in Gradle: - -[source,groovy,indent=0] ----- - dependencies { - ... - compile('org.webjars:hal-browser') - ... - } ----- - -NOTE: If you are using Spring Data REST, then a dependency on the -`spring-data-rest-hal-browser` will have an equivalent effect. - -If you do that then the main entry point will server a static HTML page to browser clients -with some JavaScript that lets you browse the available resources. - -Example: - -image::hal-browser.png[HAL Browser] - - - -== Actuator Documentation Browser -You can also provide a browser for the standard generated documentation for the Actuator -endpoints by including a dependency on the documentation jar. - -For example in Maven: - -[source,xml,indent=0] ----- - - org.springframework.boot - spring-boot-actuator-docs - ----- - -or in Gradle: - -[source,groovy,indent=0] ----- - dependencies { - ... - compile('org.springframework.boot:spring-boot-actuator-docs') - ... - } ----- - -If you do that then a new endpoint at `/` or `/docs` (relative to the -`management.context-path`) will serve up a static HTML page with this documentation in it. -The default endpoint path depends on whether or not there is already a static home page -("index.html" or a HAL browser) - if there is not and the `management.context-path` is -empty, then the docs browser shows up on the home page. diff --git a/spring-boot-actuator-docs/src/main/asciidoc/info.adoc b/spring-boot-actuator-docs/src/main/asciidoc/info.adoc deleted file mode 100644 index 9c40cb28c4..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/info.adoc +++ /dev/null @@ -1,14 +0,0 @@ -=== /info -This endpoint is empty and marked as `sensitive=false` by default (so it is -unauthenticated by default if Spring Security is in use). It reflects the content of the -`info.*` properties in the `Environment`, as well as the properties in `git.properties` -if such a file exists in the root of the classpath. - -Example curl request: -include::{generated}/info/curl-request.adoc[] - -Example HTTP request: [small]##link:../info[icon:external-link[role="silver"]]## -include::{generated}/info/http-request.adoc[] - -Example HTTP response: -include::{generated}/info/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/liquibase.adoc b/spring-boot-actuator-docs/src/main/asciidoc/liquibase.adoc deleted file mode 100644 index 4b558b8606..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/liquibase.adoc +++ /dev/null @@ -1,12 +0,0 @@ -=== /liquibase -This endpoint provides information about database migrations that have been performed -by Liquibase. - -Example curl request: -include::{generated}/liquibase/curl-request.adoc[] - -Example HTTP request: -include::{generated}/liquibase/http-request.adoc[] - -Example HTTP response: -include::{generated}/liquibase/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc b/spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc deleted file mode 100644 index 7a0b2cc68d..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc +++ /dev/null @@ -1,61 +0,0 @@ -=== /loggers -This endpoint allows you to view and modify the log levels for the loggers in your -application. It builds on top of the `LoggingSystem` abstraction and supports the same -logging frameworks. The logging levels are defined by the `LogLevel` enumeration and -consist of the following values (although not all logging systems support the full set): - -* `TRACE` -* `DEBUG` -* `INFO` -* `WARN` -* `ERROR` -* `FATAL` -* `OFF` -* `null` - -The `configuredLevel` property reflects an explicitly configured logger level, while the -`effectiveLevel` property reflects the logger level inherited from parent loggers. The -`effectiveLevel` is managed by each logging framework and reflects the propagation rules -inherent to and configured in that framework. `null` indicates that there is no explicit -configuration defined. - - - -==== Listing All Loggers -Example curl request: -include::{generated}/loggers/curl-request.adoc[] - -Example HTTP request: [small]##link:../loggers[icon:external-link[role="silver"]]## -include::{generated}/loggers/http-request.adoc[] - -Example HTTP response: -include::{generated}/loggers/http-response.adoc[] - - - -==== Getting a Single Logger -Example curl request: -include::{generated}/single-logger/curl-request.adoc[] - -Example HTTP request: [small]##link:../loggers[icon:external-link[role="silver"]]## -include::{generated}/single-logger/http-request.adoc[] - -Example HTTP response: -include::{generated}/single-logger/http-response.adoc[] - - - -==== Configuring a Logger -Setting the `configuredLevel` of a logger requires `POSTing` a partial payload to the -resource. The `configuredLevel` property must contain a string representation of the -enumeration described above. `null` indicates that the log level should be unset, -allowing it to inherit configuration from its parent. - -Example curl request: -include::{generated}/set-logger/curl-request.adoc[] - -Example HTTP request: [small]##link:../loggers[icon:external-link[role="silver"]]## -include::{generated}/set-logger/http-request.adoc[] - -Example HTTP response: -include::{generated}/set-logger/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/mappings.adoc b/spring-boot-actuator-docs/src/main/asciidoc/mappings.adoc deleted file mode 100644 index 76f85c5b9a..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/mappings.adoc +++ /dev/null @@ -1,12 +0,0 @@ -=== /mappings -This endpoint lists the Spring MVC request mappings, so users can see the handlers -registered for requests by path, method, media type, etc. - -Example curl request: -include::{generated}/mappings/curl-request.adoc[] - -Example HTTP request: [small]##link:../mappings[icon:external-link[role="silver"]]## -include::{generated}/mappings/http-request.adoc[] - -Example HTTP response: -include::{generated}/mappings/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/metrics.adoc b/spring-boot-actuator-docs/src/main/asciidoc/metrics.adoc deleted file mode 100644 index 00fcba4751..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/metrics.adoc +++ /dev/null @@ -1,15 +0,0 @@ -=== /metrics -This endpoint lists the public metrics exposed by the application. By default this -includes all the counters in the `CounterService` and all the gauges in the -`GaugeService`, plus a few JVM metrics about memory and uptime. Users can register -additional sources by creating beans of type `PublicMetrics` and/or by registering -counters and gauges. - -Example curl request: -include::{generated}/metrics/curl-request.adoc[] - -Example HTTP request: [small]##link:../metrics[icon:external-link[role="silver"]]## -include::{generated}/metrics/http-request.adoc[] - -Example HTTP response: -include::{generated}/metrics/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/main/asciidoc/trace.adoc b/spring-boot-actuator-docs/src/main/asciidoc/trace.adoc deleted file mode 100644 index 68293be079..0000000000 --- a/spring-boot-actuator-docs/src/main/asciidoc/trace.adoc +++ /dev/null @@ -1,14 +0,0 @@ -=== /trace -This endpoint lists contents of the `TraceRepository` (which users can override by -providing a bean of that type, or by injecting that bean and adding stuff to it). By -default it stores the last 100 HTTP requests, including all headers in the request and -response, and the path and HTTP status. - -Example curl request: -include::{generated}/trace/curl-request.adoc[] - -Example HTTP request: [small]##link:../trace[icon:external-link[role="silver"]]## -include::{generated}/trace/http-request.adoc[] - -Example HTTP response: -include::{generated}/trace/http-response.adoc[] diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java deleted file mode 100644 index 175d22414e..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright 2012-2017 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.hypermedia; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import groovy.text.Template; -import groovy.text.TemplateEngine; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.endpoint.mvc.ActuatorMediaTypes; -import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint; -import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints; -import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrint; -import org.springframework.boot.test.context.SpringBootContextLoader; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.util.FileCopyUtils; -import org.springframework.util.StringUtils; - -import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; -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.status; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringBootContextLoader.class) -@WebAppConfiguration -@TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true", - "endpoints.health.sensitive=true", "endpoints.actuator.enabled=false", - "management.security.enabled=false" }) -@DirtiesContext -@AutoConfigureRestDocs(EndpointDocumentation.RESTDOCS_OUTPUT_DIR) -@AutoConfigureMockMvc(print = MockMvcPrint.NONE) -public class EndpointDocumentation { - - static final String RESTDOCS_OUTPUT_DIR = "target/generated-snippets"; - - static final File LOG_FILE = new File("target/logs/spring.log"); - - private static final Set SKIPPED = Collections - .unmodifiableSet(new HashSet<>( - Arrays.asList("/docs", "/logfile", "/heapdump", "/auditevents"))); - - @Autowired - private MvcEndpoints mvcEndpoints; - - @Autowired - private TemplateEngine templates; - - @Autowired - private MockMvc mockMvc; - - @BeforeClass - public static void clearLog() { - LOG_FILE.delete(); - } - - @Test - public void logfile() throws Exception { - this.mockMvc.perform(get("/application/logfile").accept(MediaType.TEXT_PLAIN)) - .andExpect(status().isOk()).andDo(document("logfile")); - } - - @Test - public void partialLogfile() throws Exception { - FileCopyUtils.copy(getClass().getResourceAsStream("log.txt"), - new FileOutputStream(LOG_FILE)); - this.mockMvc - .perform(get("/application/logfile").accept(MediaType.TEXT_PLAIN) - .header(HttpHeaders.RANGE, "bytes=0-1024")) - .andExpect(status().isPartialContent()) - .andDo(document("partial-logfile")); - } - - @Test - public void singleLogger() throws Exception { - this.mockMvc - .perform(get("/application/loggers/org.springframework.boot") - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()).andDo(document("single-logger")); - } - - @Test - public void setLogger() throws Exception { - this.mockMvc - .perform(post("/application/loggers/org.springframework.boot") - .contentType(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON) - .content("{\"configuredLevel\": \"DEBUG\"}")) - .andExpect(status().isNoContent()).andDo(document("set-logger")); - } - - @Test - public void auditEvents() throws Exception { - this.mockMvc - .perform(get("/application/auditevents") - .param("after", "2016-11-01T10:00:00+0000") - .accept(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)) - .andExpect(status().isOk()).andDo(document("auditevents")); - } - - @Test - public void auditEventsByPrincipal() throws Exception { - this.mockMvc - .perform(get("/application/auditevents").param("principal", "admin") - .param("after", "2016-11-01T10:00:00+0000") - .accept(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)) - .andExpect(status().isOk()) - .andDo(document("auditevents/filter-by-principal")); - } - - @Test - public void auditEventsByPrincipalAndType() throws Exception { - this.mockMvc - .perform(get("/application/auditevents").param("principal", "admin") - .param("after", "2016-11-01T10:00:00+0000") - .param("type", "AUTHENTICATION_SUCCESS") - .accept(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)) - .andExpect(status().isOk()) - .andDo(document("auditevents/filter-by-principal-and-type")); - } - - @Test - public void endpoints() throws Exception { - File docs = new File("src/main/asciidoc"); - Map model = new LinkedHashMap<>(); - model.put("endpoints", getEndpointDocs(docs)); - File file = new File(RESTDOCS_OUTPUT_DIR + "/endpoints.adoc"); - file.getParentFile().mkdirs(); - try (PrintWriter writer = new PrintWriter(file, "UTF-8")) { - Template template = this.templates.createTemplate( - new File("src/restdoc/resources/templates/endpoints.adoc.tpl")); - template.make(model).writeTo(writer); - } - } - - private List getEndpointDocs(File docs) throws Exception { - final List endpoints = new ArrayList<>(); - for (MvcEndpoint endpoint : getEndpoints()) { - String path = endpoint.getPath(); - path = (StringUtils.hasText(path) ? path : "/"); - if (!SKIPPED.contains(path)) { - documentEndpoint(path); - endpoints.add(new EndpointDoc(docs, path)); - } - } - return endpoints; - } - - private Collection getEndpoints() { - List endpoints = new ArrayList<>( - this.mvcEndpoints.getEndpoints()); - endpoints.sort(Comparator.comparing(MvcEndpoint::getPath)); - return endpoints; - } - - private String documentEndpoint(final String endpointPath) throws Exception { - String output = endpointPath.substring(1); - output = (output.length() > 0 ? output : "./"); - this.mockMvc - .perform(get("/application" + endpointPath) - .accept(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)) - .andExpect(status().isOk()).andDo(document(output)); - return output; - } - - public static class EndpointDoc { - - private String path; - - private String custom; - - private String title; - - public EndpointDoc(File rootDir, String path) { - this.title = path; - this.path = path.equals("/") ? "" : path; - String custom = path.substring(1) + ".adoc"; - if (new File(rootDir, custom).exists()) { - this.custom = custom; - } - } - - public String getTitle() { - return this.title; - } - - public String getPath() { - return this.path; - } - - public String getCustom() { - return this.custom; - } - - } - -} diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HealthEndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HealthEndpointDocumentation.java deleted file mode 100644 index 2c42e85f82..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HealthEndpointDocumentation.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2012-2017 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.hypermedia; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.endpoint.mvc.ActuatorMediaTypes; -import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootContextLoader; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; - -import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringBootContextLoader.class) -@WebAppConfiguration -@TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true", - "endpoints.health.sensitive=false", "management.security.enabled=false" }) -@DirtiesContext -@AutoConfigureMockMvc -@AutoConfigureRestDocs("target/generated-snippets") -public class HealthEndpointDocumentation { - - @Autowired - private MockMvc mockMvc; - - @Test - public void health() throws Exception { - this.mockMvc - .perform(get("/application/health") - .accept(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)) - .andExpect(status().isOk()).andDo(document("health/insensitive")); - } - -} diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java deleted file mode 100644 index cd73232449..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2012-2017 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.hypermedia; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.endpoint.mvc.ActuatorMediaTypes; -import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootContextLoader; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; - -import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringBootContextLoader.class) -@WebAppConfiguration -@TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true", - "endpoints.hypermedia.enabled=true", "management.security.enabled=false" }) -@DirtiesContext -@AutoConfigureMockMvc -@AutoConfigureRestDocs("target/generated-snippets") -public class HypermediaEndpointDocumentation { - - @Autowired - private MockMvc mockMvc; - - @Test - public void beans() throws Exception { - this.mockMvc - .perform(get("/application/beans") - .accept(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)) - .andExpect(status().isOk()).andDo(document("beans/hypermedia")); - } - - @Test - public void metrics() throws Exception { - this.mockMvc - .perform(get("/application/metrics") - .accept(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)) - .andExpect(status().isOk()) - .andExpect(jsonPath("$._links.self.href") - .value("http://localhost:8080/application/metrics")) - .andDo(document("metrics/hypermedia")); - } - - @Test - public void home() throws Exception { - this.mockMvc - .perform(get("/application") - .accept(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)) - .andExpect(status().isOk()).andDo(document("admin")); - } - -} diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/LimitedEnvironmentEndpoint.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/LimitedEnvironmentEndpoint.java deleted file mode 100644 index eaa2d95140..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/LimitedEnvironmentEndpoint.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2012-2017 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.hypermedia; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.springframework.boot.actuate.endpoint.EnvironmentEndpoint; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; - -/** - * {@link EnvironmentEndpoint} with reduced output to look better in the documentation. - * - * @author Phillip Webb - */ -public class LimitedEnvironmentEndpoint extends EnvironmentEndpoint { - - private static final MultiValueMap INCLUDES; - - static { - Map> includes = new LinkedHashMap<>(); - List systemProperties = new ArrayList<>(); - systemProperties.add("java.runtime.name"); - systemProperties.add("sun.boot.library.path"); - systemProperties.add("java.vendor.url"); - systemProperties.add("path.separator"); - systemProperties.add("sun.java.launcher"); - systemProperties.add("java.runtime.version"); - systemProperties.add("os.arch"); - systemProperties.add("line.separator"); - systemProperties.add("os.name"); - systemProperties.add("user.timezone"); - systemProperties.add("file.encoding"); - systemProperties.add("java.vm.specification.version"); - systemProperties.add("sun.java.command"); - systemProperties.add("sun.arch.data.model"); - systemProperties.add("user.language"); - systemProperties.add("awt.toolkit"); - systemProperties.add("java.awt.headless"); - systemProperties.add("java.vendor"); - systemProperties.add("file.separator"); - includes.put("systemProperties", systemProperties); - List systemEnvironment = new ArrayList<>(); - systemEnvironment.add("SHELL"); - systemEnvironment.add("TMPDIR"); - systemEnvironment.add("DISPLAY"); - systemEnvironment.add("LOGNAME"); - includes.put("systemEnvironment", systemEnvironment); - INCLUDES = new LinkedMultiValueMap<>(Collections.unmodifiableMap(includes)); - } - - @Override - public Object sanitize(String name, Object object) { - if (name.equals("gopherProxySet")) { - return object; - } - return null; - } - - @Override - protected Map postProcessSourceProperties(String sourceName, - Map properties) { - List sourceIncludes = INCLUDES.get(sourceName); - if (sourceIncludes != null) { - Set> entries = properties.entrySet(); - Iterator> iterator = entries.iterator(); - while (iterator.hasNext()) { - if (!sourceIncludes.contains(iterator.next().getKey())) { - iterator.remove(); - } - } - - } - return properties; - } - -} diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/SpringBootHypermediaApplication.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/SpringBootHypermediaApplication.java deleted file mode 100644 index 34bbb92348..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/SpringBootHypermediaApplication.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2012-2017 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.hypermedia; - -import java.time.Instant; -import java.util.Collections; -import java.util.Date; - -import groovy.text.GStringTemplateEngine; -import groovy.text.TemplateEngine; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.actuate.audit.AuditEvent; -import org.springframework.boot.actuate.audit.AuditEventRepository; -import org.springframework.boot.actuate.endpoint.EnvironmentEndpoint; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; -import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; - -// Flyway must go first -@SpringBootApplication -@Import({ FlywayAutoConfiguration.class, LiquibaseAutoConfiguration.class }) -public class SpringBootHypermediaApplication implements CommandLineRunner { - - @Autowired - private AuditEventRepository auditEventRepository; - - @Bean - public TemplateEngine groovyTemplateEngine() { - return new GStringTemplateEngine(); - } - - @Bean - public EnvironmentEndpoint environmentEndpoint() { - return new LimitedEnvironmentEndpoint(); - } - - public static void main(String[] args) { - SpringApplication.run(SpringBootHypermediaApplication.class, args); - } - - @Override - public void run(String... args) throws Exception { - this.auditEventRepository.add( - createEvent("2016-11-01T11:00:00Z", "user", "AUTHENTICATION_FAILURE")); - this.auditEventRepository.add( - createEvent("2016-11-01T12:00:00Z", "admin", "AUTHENTICATION_SUCCESS")); - } - - private AuditEvent createEvent(String instant, String principal, String type) { - return new AuditEvent(Date.from(Instant.parse(instant)), principal, type, - Collections.emptyMap()); - } - -} diff --git a/spring-boot-actuator-docs/src/restdoc/resources/application.properties b/spring-boot-actuator-docs/src/restdoc/resources/application.properties deleted file mode 100644 index 0451d822f5..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -# management.context-path=/admin -logging.path: target/logs \ No newline at end of file diff --git a/spring-boot-actuator-docs/src/restdoc/resources/db/changelog/db.changelog-master.yaml b/spring-boot-actuator-docs/src/restdoc/resources/db/changelog/db.changelog-master.yaml deleted file mode 100644 index 1eb036da91..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/resources/db/changelog/db.changelog-master.yaml +++ /dev/null @@ -1,5 +0,0 @@ -databaseChangeLog: - - changeSet: - id: 1 - author: awilkinson - changes: diff --git a/spring-boot-actuator-docs/src/restdoc/resources/db/migration/V1__initialize.sql b/spring-boot-actuator-docs/src/restdoc/resources/db/migration/V1__initialize.sql deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/boot/actuate/hypermedia/log.txt b/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/boot/actuate/hypermedia/log.txt deleted file mode 100644 index 5d28249995..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/boot/actuate/hypermedia/log.txt +++ /dev/null @@ -1,24 +0,0 @@ -2016-05-10 10:55:45.405 INFO 40532 --- [ main] sanity.SanityCheckApplication : Starting SanityCheckApplication on pwmbp with PID 40532 (/Users/pwebb/projects/spring-boot/samples/spring-boot-sanity-check/target/classes started by pwebb in /Users/pwebb/projects/spring-boot/samples/spring-boot-sanity-check) -2016-05-10 10:55:45.408 INFO 40532 --- [ main] sanity.SanityCheckApplication : No active profile set, falling back to default profiles: default -2016-05-10 10:55:45.473 INFO 40532 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@59e5ddf: startup date [Tue May 10 10:55:45 PDT 2016]; root of context hierarchy -2016-05-10 10:55:47.076 INFO 40532 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) -2016-05-10 10:55:47.088 INFO 40532 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat -2016-05-10 10:55:47.090 INFO 40532 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.33 -2016-05-10 10:55:47.173 INFO 40532 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext -2016-05-10 10:55:47.173 INFO 40532 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1705 ms -2016-05-10 10:55:47.486 INFO 40532 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] -2016-05-10 10:55:47.489 INFO 40532 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] -2016-05-10 10:55:47.490 INFO 40532 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] -2016-05-10 10:55:47.490 INFO 40532 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] -2016-05-10 10:55:47.490 INFO 40532 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] -2016-05-10 10:55:47.763 INFO 40532 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@59e5ddf: startup date [Tue May 10 10:55:45 PDT 2016]; root of context hierarchy -2016-05-10 10:55:47.826 INFO 40532 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public org.springframework.http.ResponseEntity sanity.MyController.hello() -2016-05-10 10:55:47.829 INFO 40532 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) -2016-05-10 10:55:47.830 INFO 40532 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) -2016-05-10 10:55:47.864 INFO 40532 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] -2016-05-10 10:55:47.864 INFO 40532 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] -2016-05-10 10:55:47.908 INFO 40532 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] -2016-05-10 10:55:48.208 WARN 40532 --- [ main] arterDepricationWarningAutoConfiguration : spring-boot-starter-redis is deprecated as of Spring Boot 1.4, please migrate to spring-boot-starter-data-redis -2016-05-10 10:55:48.268 INFO 40532 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup -2016-05-10 10:55:48.320 ERROR 40532 --- [ main] o.a.coyote.http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler ["http-nio-8080"] - diff --git a/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/restdocs/templates/http-response.snippet b/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/restdocs/templates/http-response.snippet deleted file mode 100644 index 90a25e8514..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/resources/org/springframework/restdocs/templates/http-response.snippet +++ /dev/null @@ -1,8 +0,0 @@ -[source,http,options="nowrap"] ----- -HTTP/1.1 {{statusCode}} {{statusReason}} -{{#headers}} -{{name}}: {{value}} -{{/headers}} -{{responseBody}} ----- \ No newline at end of file diff --git a/spring-boot-actuator-docs/src/restdoc/resources/templates/endpoints.adoc.tpl b/spring-boot-actuator-docs/src/restdoc/resources/templates/endpoints.adoc.tpl deleted file mode 100644 index cd6963a233..0000000000 --- a/spring-boot-actuator-docs/src/restdoc/resources/templates/endpoints.adoc.tpl +++ /dev/null @@ -1,16 +0,0 @@ -<% endpoints.each { endpoint -> - if (endpoint.custom) { %> -include::{docs}/${endpoint.custom}[] -<% } else { %> -=== Link: ${endpoint.title} - -Example curl request: -include::{generated}${endpoint.path}/curl-request.adoc[] - -Example HTTP request: -include::{generated}${endpoint.path}/http-request.adoc[] - -Example HTTP response: -include::{generated}${endpoint.path}/http-response.adoc[] -<% } -} %> \ No newline at end of file diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java index 2e839e8319..2a2371a530 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java @@ -33,38 +33,28 @@ import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration.EndpointHypermediaEnabledCondition; import org.springframework.boot.actuate.condition.ConditionalOnEnabledEndpoint; import org.springframework.boot.actuate.endpoint.mvc.ActuatorMediaTypes; -import org.springframework.boot.actuate.endpoint.mvc.DocsMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.HalBrowserMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.HalJsonMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled; import org.springframework.boot.actuate.endpoint.mvc.ManagementServletContext; import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints; -import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.condition.ConditionalOnResource; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.boot.autoconfigure.web.ResourceProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Conditional; -import org.springframework.context.annotation.Configuration; import org.springframework.core.MethodParameter; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.io.ResourceLoader; import org.springframework.hateoas.Link; import org.springframework.hateoas.Resource; import org.springframework.hateoas.ResourceSupport; -import org.springframework.hateoas.UriTemplate; -import org.springframework.hateoas.hal.CurieProvider; -import org.springframework.hateoas.hal.DefaultCurieProvider; import org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter; import org.springframework.http.MediaType; import org.springframework.http.converter.AbstractHttpMessageConverter; @@ -93,7 +83,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; @ConditionalOnClass(Link.class) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnBean(HttpMessageConverters.class) -@Conditional(EndpointHypermediaEnabledCondition.class) +@ConditionalOnEnabledEndpoint("actuator") @EnableConfigurationProperties({ ResourceProperties.class, ManagementServerProperties.class }) public class EndpointWebMvcHypermediaManagementContextConfiguration { @@ -104,7 +94,6 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { return properties::getContextPath; } - @ConditionalOnEnabledEndpoint("actuator") @Bean public HalJsonMvcEndpoint halJsonMvcEndpoint( ManagementServletContext managementServletContext, @@ -115,30 +104,6 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { return new HalJsonMvcEndpoint(managementServletContext); } - @Bean - @ConditionalOnBean(DocsMvcEndpoint.class) - @ConditionalOnMissingBean(CurieProvider.class) - @ConditionalOnProperty(prefix = "endpoints.docs.curies", name = "enabled", matchIfMissing = false) - public DefaultCurieProvider curieProvider(ManagementServerProperties management, - DocsMvcEndpoint endpoint) { - String path = management.getContextPath() + endpoint.getPath() - + "/#spring_boot_actuator__{rel}"; - return new DefaultCurieProvider("boot", new UriTemplate(path)); - } - - @Configuration - static class DocsMvcEndpointConfiguration { - - @Bean - @ConditionalOnEnabledEndpoint("docs") - @ConditionalOnResource(resources = "classpath:/META-INF/resources/spring-boot-actuator/docs/index.html") - public DocsMvcEndpoint docsMvcEndpoint( - ManagementServletContext managementServletContext) { - return new DocsMvcEndpoint(managementServletContext); - } - - } - /** * Controller advice that adds links to the actuator endpoint's path. */ @@ -363,22 +328,4 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { } - static class EndpointHypermediaEnabledCondition extends AnyNestedCondition { - - EndpointHypermediaEnabledCondition() { - super(ConfigurationPhase.REGISTER_BEAN); - } - - @ConditionalOnEnabledEndpoint("actuator") - static class ActuatorEndpointEnabled { - - } - - @ConditionalOnEnabledEndpoint("docs") - static class DocsEndpointEnabled { - - } - - } - } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java deleted file mode 100644 index a7c950c5fe..0000000000 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2012-2017 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.endpoint.mvc; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; - -/** - * {@link MvcEndpoint} to expose actuator documentation. - * - * @author Dave Syer - * @since 1.3.0 - */ -@ConfigurationProperties(prefix = "endpoints.docs") -public class DocsMvcEndpoint extends AbstractNamedMvcEndpoint { - - private static final String DOCS_LOCATION = "classpath:/META-INF/resources/spring-boot-actuator/docs/"; - - private final ManagementServletContext managementServletContext; - - private Curies curies = new Curies(); - - public Curies getCuries() { - return this.curies; - } - - public DocsMvcEndpoint(ManagementServletContext managementServletContext) { - super("docs", "/docs", false); - this.managementServletContext = managementServletContext; - } - - @RequestMapping(value = "/", produces = MediaType.TEXT_HTML_VALUE) - public String browse() { - return "forward:" + this.managementServletContext.getContextPath() + getPath() - + "/index.html"; - } - - @RequestMapping(value = "", produces = MediaType.TEXT_HTML_VALUE) - public String redirect() { - return "redirect:" + this.managementServletContext.getContextPath() + getPath() - + "/"; - } - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler( - this.managementServletContext.getContextPath() + getPath() + "/**") - .addResourceLocations(DOCS_LOCATION); - } - - /** - * Properties of the default CurieProvider (used for adding docs links). If enabled, - * all unqualified rels will pick up a prefix and a curie template pointing to the - * docs endpoint. - */ - public static class Curies { - - /** - * Enable the curie generation. - */ - private boolean enabled = false; - - public boolean isEnabled() { - return this.enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - } - -} diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/BootCuriesHrefIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/BootCuriesHrefIntegrationTests.java deleted file mode 100644 index f263acc9a9..0000000000 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/BootCuriesHrefIntegrationTests.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2012-2017 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.autoconfigure; - -import java.net.URL; - -import com.jayway.jsonpath.JsonPath; -import net.minidev.json.JSONArray; -import org.junit.After; -import org.junit.Test; - -import org.springframework.boot.test.util.TestPropertyValues; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer; -import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.ResponseEntity; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Integration tests for the href of the actuator's curies link - * - * @author Andy Wilkinson - */ -public class BootCuriesHrefIntegrationTests { - - private AnnotationConfigServletWebServerApplicationContext context; - - @After - public void closeContext() { - this.context.close(); - } - - @Test - public void basicCuriesHref() { - int port = load("endpoints.docs.curies.enabled:true", "server.port:0"); - assertThat(getCurieHref("http://localhost:" + port + "/application")) - .isEqualTo("http://localhost:" + port - + "/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void curiesHrefWithCustomContextPath() { - int port = load("endpoints.docs.curies.enabled:true", "server.port:0", - "server.servlet.context-path:/context"); - assertThat(getCurieHref("http://localhost:" + port + "/context/application")) - .isEqualTo("http://localhost:" + port - + "/context/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void curiesHrefWithCustomServletPath() { - int port = load("endpoints.docs.curies.enabled:true", "server.port:0", - "server.servlet.path:/servlet"); - assertThat(getCurieHref("http://localhost:" + port + "/servlet/application")) - .isEqualTo("http://localhost:" + port - + "/servlet/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void curiesHrefWithCustomServletAndContextPaths() { - int port = load("endpoints.docs.curies.enabled:true", "server.port:0", - "server.servlet.context-path:/context", "server.servlet.path:/servlet"); - assertThat(getCurieHref("http://localhost:" + port - + "/context/servlet/application")).isEqualTo("http://localhost:" + port - + "/context/servlet/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void curiesHrefWithCustomServletContextAndManagementContextPaths() { - int port = load("endpoints.docs.curies.enabled:true", "server.port:0", - "server.servlet.context-path:/context", "server.servlet.path:/servlet", - "management.context-path:/management"); - assertThat(getCurieHref("http://localhost:" + port - + "/context/servlet/management/")).isEqualTo("http://localhost:" + port - + "/context/servlet/management/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void serverPathsAreIgnoredWithSeparateManagementPort() { - int port = load("endpoints.docs.curies.enabled:true", "server.port:0", - "server.servlet.context-path:/context", "server.servlet.path:/servlet", - "management.port:0"); - assertThat(getCurieHref("http://localhost:" + port + "/application/")) - .isEqualTo("http://localhost:" + port - + "/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void managementContextPathWithSeparateManagementPort() { - int port = load("endpoints.docs.curies.enabled:true", - "management.context-path:/management", "server.port:0", - "management.port:0"); - assertThat(getCurieHref("http://localhost:" + port + "/management/")) - .isEqualTo("http://localhost:" + port - + "/management/docs/#spring_boot_actuator__{rel}"); - } - - private int load(String... properties) { - this.context = new AnnotationConfigServletWebServerApplicationContext(); - this.context.setClassLoader(new ClassLoader(getClass().getClassLoader()) { - - @Override - public URL getResource(String name) { - if ("META-INF/resources/spring-boot-actuator/docs/index.html" - .equals(name)) { - return super.getResource("actuator-docs-index.html"); - } - return super.getResource(name); - } - - }); - TestPropertyValues.of(properties).applyTo(this.context); - this.context.register(TestConfiguration.class); - new ServerPortInfoApplicationContextInitializer().initialize(this.context); - this.context.refresh(); - return Integer.parseInt( - this.context.getEnvironment().getProperty("local.management.port")); - } - - private String getCurieHref(String uri) { - ResponseEntity response = new TestRestTemplate().getForEntity(uri, - String.class); - JSONArray bootCuriesHrefs = JsonPath.parse(response.getBody()) - .read("_links.curies[?(@.name == 'boot')].href"); - assertThat(bootCuriesHrefs).hasSize(1); - return (String) bootCuriesHrefs.get(0); - } - - @Configuration - @MinimalActuatorHypermediaApplication - static class TestConfiguration { - - } - -} diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfigurationTests.java index 47d0a145b6..17f737bca6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfigurationTests.java @@ -16,13 +16,10 @@ package org.springframework.boot.actuate.autoconfigure; -import java.net.URL; - import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.springframework.boot.actuate.endpoint.mvc.DocsMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.HalJsonMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.ManagementServletContext; import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints; @@ -32,7 +29,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.test.util.TestPropertyValues; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.hateoas.Link; import org.springframework.hateoas.hal.DefaultCurieProvider; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.web.context.request.RequestContextHolder; @@ -72,60 +68,11 @@ public class EndpointWebMvcHypermediaManagementContextConfigurationTests { assertThat(this.context.getBeansOfType(ManagementServletContext.class)) .hasSize(1); assertThat(this.context.getBeansOfType(HalJsonMvcEndpoint.class)).hasSize(1); - assertThat(this.context.getBeansOfType(DocsMvcEndpoint.class)).hasSize(1); assertThat(this.context.getBeansOfType(DefaultCurieProvider.class)).isEmpty(); } - @Test - public void curiesEnabledWithDefaultPorts() { - load("endpoints.docs.curies.enabled:true"); - assertThat(getCurieHref()).isEqualTo( - "http://localhost/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void curiesEnabledWithRandomPorts() { - load("endpoints.docs.curies.enabled:true", "server.port:0", "management.port:0"); - assertThat(getCurieHref()).isEqualTo( - "http://localhost/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void curiesEnabledWithSpecificServerPort() { - load("endpoints.docs.curies.enabled:true", "server.port:8080"); - assertThat(getCurieHref()).isEqualTo( - "http://localhost/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void curiesEnabledWithSpecificManagementPort() { - load("endpoints.docs.curies.enabled:true", "management.port:8081"); - assertThat(getCurieHref()).isEqualTo( - "http://localhost/application/docs/#spring_boot_actuator__{rel}"); - } - - @Test - public void curiesEnabledWithSpecificManagementAndServerPorts() { - load("endpoints.docs.curies.enabled:true", "server.port:8080", - "management.port:8081"); - assertThat(getCurieHref()).isEqualTo( - "http://localhost/application/docs/#spring_boot_actuator__{rel}"); - } - private void load(String... properties) { this.context = new AnnotationConfigWebApplicationContext(); - this.context.setClassLoader(new ClassLoader(getClass().getClassLoader()) { - - @Override - public URL getResource(String name) { - if ("META-INF/resources/spring-boot-actuator/docs/index.html" - .equals(name)) { - return super.getResource("actuator-docs-index.html"); - } - return super.getResource(name); - } - - }); TestPropertyValues.of(properties).applyTo(this.context); this.context.register(TestConfiguration.class, HttpMessageConvertersAutoConfiguration.class, @@ -133,13 +80,6 @@ public class EndpointWebMvcHypermediaManagementContextConfigurationTests { this.context.refresh(); } - private String getCurieHref() { - DefaultCurieProvider curieProvider = this.context - .getBean(DefaultCurieProvider.class); - Link link = (Link) curieProvider.getCurieInformation(null).iterator().next(); - return link.getHref(); - } - @Configuration @EnableConfigurationProperties({ ManagementServerProperties.class, ServerProperties.class }) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java index 143f901abd..7484425361 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java @@ -36,7 +36,6 @@ import org.springframework.boot.actuate.endpoint.RequestMappingEndpoint; import org.springframework.boot.actuate.endpoint.ShutdownEndpoint; import org.springframework.boot.actuate.endpoint.TraceEndpoint; import org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint; -import org.springframework.boot.actuate.endpoint.mvc.DocsMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter; import org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.HalJsonMvcEndpoint; @@ -44,7 +43,6 @@ import org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.LogFileMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint; -import org.springframework.boot.actuate.endpoint.mvc.ManagementServletContext; import org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints; @@ -90,7 +88,6 @@ public class MvcEndpointPathConfigurationTests { new Object[] { "beans", BeansEndpoint.class }, new Object[] { "configprops", ConfigurationPropertiesReportEndpoint.class }, - new Object[] { "docs", DocsMvcEndpoint.class }, new Object[] { "dump", DumpEndpoint.class }, new Object[] { "env", EnvironmentMvcEndpoint.class }, new Object[] { "flyway", FlywayEndpoint.class }, @@ -169,11 +166,6 @@ public class MvcEndpointPathConfigurationTests { return new LiquibaseEndpoint(new SpringLiquibase()); } - @Bean - public DocsMvcEndpoint docs(ManagementServletContext managementServletContext) { - return new DocsMvcEndpoint(managementServletContext); - } - } } diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index d3b1ef7761..326fc440d1 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -240,11 +240,6 @@ spring-boot-actuator 2.0.0.BUILD-SNAPSHOT - - org.springframework.boot - spring-boot-actuator-docs - 2.0.0.BUILD-SNAPSHOT - org.springframework.boot spring-boot-autoconfigure diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index d44c28060e..c8ff71fddb 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -144,11 +144,6 @@ If you are using Spring MVC, the following additional endpoints can also be used |=== | ID | Description | Sensitive Default -|`docs` -|Displays documentation, including example requests and responses, for the Actuator's -endpoints. Requires `spring-boot-actuator-docs` to be on the classpath. -|false - |`heapdump` |Returns a GZip compressed `hprof` heap dump file. |true diff --git a/spring-boot-full-build/pom.xml b/spring-boot-full-build/pom.xml index 4773efa1fa..087437e2d9 100644 --- a/spring-boot-full-build/pom.xml +++ b/spring-boot-full-build/pom.xml @@ -53,7 +53,6 @@ ../spring-boot-autoconfigure ../spring-boot-test-autoconfigure ../spring-boot-actuator - ../spring-boot-actuator-docs ../spring-boot-devtools ../spring-boot-starters ../spring-boot-cli diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/pom.xml b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/pom.xml index 40004e9c54..6634edc541 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/pom.xml +++ b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/pom.xml @@ -27,10 +27,6 @@ org.springframework.boot spring-boot-starter-hateoas - - org.springframework.boot - spring-boot-actuator-docs - org.springframework.boot spring-boot-starter-data-rest diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java index d81b6f7ab4..c7709c9bb0 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java @@ -59,14 +59,6 @@ public class SampleHypermediaJpaApplicationIntegrationTests { .andExpect(status().isOk()).andExpect(jsonPath("$._links").exists()); } - @Test - public void docs() throws Exception { - MvcResult response = this.mockMvc - .perform(get("/admin/docs/").accept(MediaType.TEXT_HTML)) - .andExpect(status().isOk()).andReturn(); - System.err.println(response.getResponse().getContentAsString()); - } - @Test public void browser() throws Exception { MvcResult response = this.mockMvc.perform(get("/").accept(MediaType.TEXT_HTML)) diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/pom.xml b/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/pom.xml index f994693be1..4584c8ff7a 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/pom.xml +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/pom.xml @@ -31,10 +31,6 @@ org.springframework.boot spring-boot-starter-hateoas - - org.springframework.boot - spring-boot-actuator-docs - org.springframework.boot diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui/pom.xml b/spring-boot-samples/spring-boot-sample-hypermedia-ui/pom.xml index 4bed47f83b..f9f0e6e687 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui/pom.xml +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui/pom.xml @@ -27,10 +27,6 @@ org.springframework.boot spring-boot-starter-hateoas - - org.springframework.boot - spring-boot-actuator-docs - org.springframework.boot diff --git a/spring-boot-samples/spring-boot-sample-hypermedia/pom.xml b/spring-boot-samples/spring-boot-sample-hypermedia/pom.xml index 5444a873e6..b8f6b31863 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia/pom.xml +++ b/spring-boot-samples/spring-boot-sample-hypermedia/pom.xml @@ -28,10 +28,6 @@ org.springframework.boot spring-boot-starter-hateoas - - org.springframework.boot - spring-boot-actuator-docs - org.webjars hal-browser