Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide support for WebFlux-based management endpoints #7970

Closed
philwebb opened this issue Jan 12, 2017 · 1 comment
Closed

Provide support for WebFlux-based management endpoints #7970

philwebb opened this issue Jan 12, 2017 · 1 comment
Labels
type: enhancement A general enhancement
Milestone

Comments

@philwebb
Copy link
Member

No description provided.

@philwebb philwebb modified the milestones: 2.0.0, 2.0.0.M2 Jan 12, 2017
@snicoll snicoll modified the milestones: 2.0.0.M2, 2.0.0.M3 May 30, 2017
@kuhnroyal
Copy link

kuhnroyal commented Jul 6, 2017

A very basic approach without security:

import org.springframework.boot.actuate.autoconfigure.ManagementServerProperties
import org.springframework.boot.actuate.endpoint.AbstractEndpoint
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.ApplicationContext
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.http.MediaType.APPLICATION_JSON
import org.springframework.web.reactive.function.server.ServerResponse
import org.springframework.web.reactive.function.server.body
import org.springframework.web.reactive.function.server.router
import reactor.core.publisher.toMono

@Configuration
@EnableConfigurationProperties(ManagementServerProperties::class)
class ActuatorRoutes(
  private val properties: ManagementServerProperties,
  private val ctx: ApplicationContext
) {
  @Bean
  fun actuatorRouter() = router {
    (properties.contextPath and accept(APPLICATION_JSON)).nest {
      ctx.getBeansOfType(AbstractEndpoint::class.java).forEach { _, v ->
        GET("/" + v.id, { _ -> ServerResponse.ok().json().body(v.invoke().toMono()) })
      }
    }
  }
}

@snicoll snicoll modified the milestones: 2.0.0.M3, 2.0.0.M4 Jul 13, 2017
@philwebb philwebb modified the milestones: 2.0.0.M4, 2.0.0.M5 Jul 28, 2017
@wilkinsona wilkinsona modified the milestones: 2.0.0.M4, 2.0.0.M5 Aug 3, 2017
@wilkinsona wilkinsona added type: enhancement A general enhancement and removed type: task A general task labels Aug 3, 2017
@wilkinsona wilkinsona changed the title Explore reactive endpoint API Provide support for WebFlux-based management endpoints Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants